From eb34414359019e785343419870a6f3ef6c03b5b2 Mon Sep 17 00:00:00 2001 From: gdi2290 Date: Mon, 9 Mar 2015 22:56:59 -0700 Subject: [PATCH] refactor(example): hello flickr constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When I go to `settings` then settings it doesn’t nest again. when I click on `settings` then flickr I’m prompted with two `canDeactivate` confirms. Is that normal? --- examples/angular-1/hello/components/flickr/flickr.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/angular-1/hello/components/flickr/flickr.js b/examples/angular-1/hello/components/flickr/flickr.js index 0250374..fa73d0b 100644 --- a/examples/angular-1/hello/components/flickr/flickr.js +++ b/examples/angular-1/hello/components/flickr/flickr.js @@ -1,11 +1,12 @@ 'use strict'; angular.module('example.flickr', []). - controller('FlickrController', ['$http', FlickrController]); + constant('flickrURL', 'http://api.flickr.com/services/feeds/photos_public.gne?tags=angularjs&tagmode=any&format=json'). + controller('FlickrController', ['$http', 'flickrURL', FlickrController]); -var URL = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=angularjs&tagmode=any&format=json'; -function FlickrController($http) { +function FlickrController($http, flickrURL) { + this.flickrURL = flickrURL; this.heading = 'Flickr'; this.images = []; this.http = $http; @@ -21,7 +22,7 @@ FlickrController.prototype.activate = function() { self.images = result.items; }; - this.http.jsonp(URL); + this.http.jsonp(this.flickrURL); }; FlickrController.prototype.canDeactivate = function() {