mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 13:01:01 +08:00
53 lines
931 B
TypeScript
53 lines
931 B
TypeScript
import {ViewChild} from 'angular2/core';
|
|
import {App, Slides} from 'ionic-angular';
|
|
|
|
|
|
@App({
|
|
templateUrl: 'main.html'
|
|
})
|
|
class MyApp {
|
|
mySlideOptions: any;
|
|
@ViewChild(Slides) slider: Slides;
|
|
|
|
constructor() {
|
|
console.log("here");
|
|
this.mySlideOptions = {
|
|
initialSlide: 1,
|
|
autoplay: 1000
|
|
};
|
|
}
|
|
|
|
ngAfterViewInit() {
|
|
|
|
}
|
|
|
|
onSlideChanged() {
|
|
console.log("Slide Changed");
|
|
let isEnd = this.slider.isEnd();
|
|
console.log("This is the last slide?", isEnd);
|
|
}
|
|
|
|
goToPrevSlide() {
|
|
this.slider.slidePrev(5000, false);
|
|
}
|
|
|
|
goToNextSlide() {
|
|
this.slider.slideNext();
|
|
}
|
|
|
|
goToSlide(index) {
|
|
console.log(index);
|
|
this.slider.slideTo(index, 500, false);
|
|
}
|
|
|
|
getIndex() {
|
|
let index = this.slider.getActiveIndex();
|
|
console.log("Current Index is", index);
|
|
}
|
|
|
|
getLength() {
|
|
let length = this.slider.length();
|
|
console.log("Current Length is", length);
|
|
}
|
|
}
|