i am newbie in angular2 and now i am trying use owl carousel
i found this tutorial but its give me many errors and i could figure out what's a problem,so can someone explain again.thanks
How to use owl-carousel in Angular2?
this is my code
Home Component html
<owl-carousel [options]="{navigation: false, pagination: true, rewindNav : false}">
<div *ngFor="let img of images">
<img src="http://lorempixel.com/400/200/{{img}}"/>
</div>
</owl-carousel>
Home Component ts
import { Component, OnInit } from '@angular/core';
import { OwlCarousel } from '../owl-carousel.component';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
constructor() { }
ngOnInit() {
}
images: Array<string> = ['sports', 'abstract', 'people', 'transport', 'city', 'technics', 'nightlife', 'animals'];
}
i also imported in app.module.ts
owl.component.ts
import { Component, Input, ElementRef, HostBinding } from '@angular/core';
import * as $ from 'jquery';
import 'owl-carousel';
@Component({
selector: 'owl-carousel',
template: `<ng-content></ng-content>`
})
export class OwlCarousel {
@HostBinding('class') defaultClass = 'owl-carousel';
@Input() options: object;
$owlElement: any;
defaultOptions: any = {};
constructor(private el: ElementRef) {}
ngAfterViewInit() {
// use default - empty
// for (var key in this.options) {
// this.defaultOptions[key] = this.options[key];
// }
this.$owlElement = $(this.el.nativeElement).owlCarousel(this.defaultOptions);
}
ngOnDestroy() {
this.$owlElement.data('owlCarousel').destroy();
this.$owlElement = null;
}
}
errors
Cannot find module 'jquery'. Module not found: Error: Can't resolve 'owl-carousel'