mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
test(slides): update to use @ViewChild
This commit is contained in:
@ -1,20 +1,23 @@
|
||||
import {App, IonicApp} from 'ionic-angular';
|
||||
import {ViewChild} from 'angular2/core';
|
||||
import {Http} from 'angular2/http';
|
||||
import {App, Slides} from 'ionic-angular';
|
||||
|
||||
|
||||
@App({
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
class MyApp {
|
||||
constructor(app: IonicApp, http: Http) {
|
||||
this.app = app;
|
||||
this.http = http;
|
||||
mySlideOptions: any;
|
||||
images: string[] = [];
|
||||
@ViewChild(Slides) slider: Slides;
|
||||
|
||||
constructor(private http: Http) {
|
||||
this.mySlideOptions = {
|
||||
loop: true
|
||||
};
|
||||
}
|
||||
|
||||
this.images = [];
|
||||
|
||||
ngAfterViewInit() {
|
||||
let tags = "amsterdam";
|
||||
let FLICKR_API_KEY = '504fd7414f6275eb5b657ddbfba80a2c';
|
||||
|
||||
@ -27,24 +30,15 @@ class MyApp {
|
||||
setTimeout(() => {
|
||||
this.slider.update();
|
||||
});
|
||||
|
||||
}, (err) => {
|
||||
console.info('Unable to load images');
|
||||
console.error(err);
|
||||
})
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
setTimeout(() => {
|
||||
this.slider = this.app.getComponent('slider');
|
||||
console.log('Got slider', this.slider);
|
||||
});
|
||||
}
|
||||
|
||||
getImageUrl(item) {
|
||||
return "http://farm"+ item.farm +".static.flickr.com/"+ item.server +"/"+ item.id +"_"+ item.secret + "_z.jpg";
|
||||
return `http://farm${item.farm}.static.flickr.com/${item.server}/${item.id}_${item.secret}_z.jpg`;
|
||||
}
|
||||
|
||||
doRefresh() {
|
||||
console.log('DOREFRESH')
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user