fix(slides): fixed the Http call, it is now using Angular's

references #642
This commit is contained in:
Brandy Carney
2015-11-25 12:06:15 -05:00
parent 38bd1b1428
commit 46191bdd42

View File

@@ -1,11 +1,14 @@
import {App, IonicApp} from 'ionic/ionic';
import {Http} from 'angular2/http';
@App({
templateUrl: 'main.html'
})
class MyApp {
constructor(private app: IonicApp) {
constructor(app: IonicApp, http: Http) {
this.app = app;
this.http = http;
this.extraOptions = {
loop: true
};
@@ -17,14 +20,14 @@ class MyApp {
let baseUrl = 'https://api.flickr.com/services/rest/';
// TODO: update to use angular2's HTTP Service
Http.get(baseUrl + '?method=flickr.groups.pools.getPhotos&group_id=1463451@N25&safe_search=1&api_key=' + FLICKR_API_KEY + '&jsoncallback=JSON_CALLBACK&format=json&tags=' + tags, {
method: 'jsonp'
}).then((val) => {
this.images = val.photos.photo.slice(0, 20);
setTimeout(() => {
this.slider.update();
});
this.http.get(baseUrl + '?method=flickr.groups.pools.getPhotos&group_id=1463451@N25&safe_search=1&api_key='
+ FLICKR_API_KEY + '&nojsoncallback=1&format=json&tags=' + tags)
.map(res => res.json())
.subscribe(data => {
this.images = data.photos.photo.slice(0, 20);
setTimeout(() => {
this.slider.update();
});
}, (err) => {
alert('Unable to load images');
console.error(err);