Skip to content

Instantly share code, notes, and snippets.

@jessecogollo
Created February 9, 2015 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessecogollo/30c528077d90dd415b02 to your computer and use it in GitHub Desktop.
Save jessecogollo/30c528077d90dd415b02 to your computer and use it in GitHub Desktop.
flickr.js (Proyecto base aurelia.io)
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