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 ?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Yes. I installed it with Yarn: yarn add owl.carousel jquery
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
This might help https://github.com/angular/angular-cli/issues/4533
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thanks, mate! :-)
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)