Im trying to use owl.carousel onto my angular app, here's a fiddle of what's the objective.
https://owlcarousel2.github.io/OwlCarousel2/demos/mousewheel.html
The steps i took were:
Downloaded the zip from the owl-carousel website
paste them on ../node_modules/owlCarousel/
didn't need to add the .css and .js files on index.html because its an internal module (which can be found on node_modules)
On angular-cli.json i've added on scripts the path for those .js files
"scripts": [
"../node_modules/owlCarousel/dist/owl.carousel.js",
"../node_modules/owlCarousel/dist/owl.carousel.min.js",
....
i what to use the carousel on my menu compontent, the problem is that when i call the funtion on ngInit() menu.compontent.ts:
$(document).ready(function(){
$(".owl-carousel").owlCarousel();
});
it gives an error on owlCarousel(), saying that "owlCarousel does not exist on type 'jQuery'.
am i supose to export something on index.ts that i use to export all compontentes of shared folder? Or i need to import something on menu.component.ts, if so, what?
heres my menu.compontent.ts:
import { Component, OnInit } from '@angular/core';
//import * as $ from "jquery";
declare var $: any;
@Component({
selector: 'app-menu',
templateUrl: './menu.component.html',
styleUrls: ['./menu.component.scss']
})
export class MenuComponent implements OnInit {
constructor() {
}
ngOnInit() {
$(document).ready(function(){
$(".owl-carousel").owlCarousel();
});
$('#myDropdown').on('hide.bs.dropdown', function () {
return false;
});
}
closeNav() {
document.getElementById("mySidenav").style.width = "0";
}
}
declare const $and delete import