Created
February 9, 2015 03:55
-
-
Save jessecogollo/30c528077d90dd415b02 to your computer and use it in GitHub Desktop.
flickr.js (Proyecto base aurelia.io)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {HttpClient} from 'aurelia-http-client'; | |
var url = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=rainier&tagmode=any&format=json'; | |
export class Flickr{ | |
static inject() { return [HttpClient]; } | |
constructor(http){ | |
this.heading = 'Flickr'; | |
this.images = []; | |
this.http = http; | |
} | |
activate(){ | |
return this.http.jsonp(url).then(response => { | |
this.images = response.content.items; | |
}); | |
} | |
canDeactivate(){ | |
return confirm('Are you sure you want to leave?'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment