test(slides): adding slides test for loop with a ngFor

references #751
This commit is contained in:
Brandy Carney
2015-12-15 18:43:00 -05:00
parent 8bc399d13e
commit d7f481bf4c
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,37 @@
import {App, IonicApp} from 'ionic/ionic';
@App({
templateUrl: 'main.html'
})
class MyApp {
constructor(app: IonicApp) {
this.app = app;
this.slides = [
{
name: "Slide 1",
class: "yellow"
},
{
name: "Slide 2",
class: "red"
},
{
name: "Slide 3",
class: "blue"
}
];
}
onSlideChanged(slider) {
console.log('Slide changed', slider);
console.log("active index", slider.activeIndex);
}
ngOnInit() {
setTimeout(() => {
this.slider = this.app.getComponent('loopSlider');
console.log('Got slider', this.slider);
});
}
}

View File

@ -0,0 +1,19 @@
<ion-slides loop="true" id="loopSlider" (slideChanged)="onSlideChanged($event)" pager>
<ion-slide *ngFor="#slide of slides" [ngClass]="slide.class">
{{ slide.name }}
</ion-slide>
</ion-slides>
<style>
.yellow {
background-color: #fbeb14;
}
.red {
background-color: #ED4337;
}
.blue {
background-color: #89cff0;
}
</style>