Hello
I'm trying to install owl-carousel in my solution but I get error message Property 'owlCarousel' does not exist on type 'JQuery'. If i put this code in typings.d.ts: interface JQuery { owlCarousel(...any): any; }
then I get this error: TypeError: owl.owlCarousel is not a function I have this code in my component:
import * as $ from 'jquery'; import 'owl.carousel/dist/assets/owl.carousel.css'; import 'owl.carousel';
export class SiteComponent extends AppComponentBase implements OnInit, AfterViewInit { @ViewChild('owl') owl: ElementRef;
ngAfterViewInit() { $(this.owl.nativeElement).owlCarousel(); }
.angular-cli.json:
"styles": ["../node_modules/owl.carousel/dist/assets/owl.theme.default.css"] "scripts": ["../node_modules/jquery/dist/jquery.js", "../node_modules/owl.carousel/dist/owl.carousel.js" ],
Any ideas?
4 Answer(s)
-
0
Hi,
Is it the package https://www.npmjs.com/package/owl.carousel ?
-
0
Yes. I installed it with Yarn: yarn add owl.carousel jquery
-
0
This might help https://github.com/angular/angular-cli/issues/4533
-
0
Thanks, mate! :-)