test(slides): update to use @ViewChild

This commit is contained in:
Adam Bradley
2016-04-16 23:09:13 -05:00
parent 1daa7c5382
commit 2295bd9264
4 changed files with 23 additions and 34 deletions

View File

@ -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')
}
}