I want to do an image slider in a route page of Angular 2. I plugged in the flexslider and bootstrap carousel but I did not do it anyway. How can I do that?
My Route Page Code is
import { Component, ViewChild, ElementRef, AfterViewInit } from '@angular/core';
import { Injectable } from '@angular/core';
import { Http, Headers } from '@angular/http';
import 'rxjs/add/operator/map';
import { ProviderMain } from '../provider/provider';
import { ActivatedRoute } from '@angular/router';
import * as $ from 'jquery';
@Component({
selector: 'detail',
templateUrl: '/app/detail/detail.html',
providers: [ProviderMain],
})
export class Detail
{
public link: any;
public mainData: any;
public bookingInformation: Array<any>;
public detail: Array<any>;
public information: any;
public itemImages: Array<any>;
private NextPhotoInterval: number = 5000;
//Looping or not
private noLoopSlides: boolean = true;
//Photos
constructor(public http: Http, public routePrm: ActivatedRoute, public provide: ProviderMain)
{
console.log("Detail Html Başladı");
this.routePrm.params.subscribe(params => {
this.link = params["link"];
this.getDetail(this.link);
});
}
ngAfterViewInit() {
}
getDetail(link: any) {
this.provide.getServiceDetailInformation(link).then(data => {
this.bookingInformation = data.bookingInformation;
this.detail = data.detail;
this.information = data.information[0];
this.itemImages = data.itemImages;
});
}
}
and my html code is
<div id="slider" class="flexslider">
<ul class="slides">
<li>
<img src="assets/images/holiday-slide3.jpg" alt="cruise">
</li>
<li>
<img src="assets/images/holiday-slide4.jpg" alt="cruise">
</li>
<li>
<img src="assets/images/slide15.jpg" alt="cruise">
</li>
<li>
<img src="assets/images/holiday-slide3.jpg" alt="cruise">
</li>
<li>
<img src="assets/images/holiday-slide4.jpg" alt="cruise">
</li>
<li>
<img src="assets/images/slide15.jpg" alt="cruise">
</li>
</ul>
</div>
<div id="carousel" class="flexslider">
<ul class="slides">
<li>
<img src="assets/images/holiday-thumb3.jpg" alt="cruise">
</li>
<li>
<img src="assets/images/holiday-thumb4.jpg" alt="cruise">
</li>
<li>
<img src="assets/images/holiday-thumb5.jpg" alt="cruise">
</li>
<li>
<img src="assets/images/holiday-thumb3.jpg" alt="cruise">
</li>
<li>
<img src="assets/images/holiday-thumb4.jpg" alt="cruise">
</li>
<li>
<img src="assets/images/holiday-thumb5.jpg" alt="cruise">
</li>
</ul>
</div>
If the plugin I normally use is
$(document).ready(function () {
$('#carousel').flexslider({
animation: "slide",
controlNav: false,
animationLoop: false,
slideshow: false,
itemWidth: 150,
itemMargin: 5,
asNavFor: '#slider'
});
$('#slider').flexslider({
animation: "slide",
controlNav: false,
animationLoop: false,
slideshow: false,
sync: "#carousel"
});
});
Bu That is not work.How can I do that ? Thank for all.