Created
August 23, 2014 03:21
-
-
Save mager/3f4b9dc5b4db10e30434 to your computer and use it in GitHub Desktop.
instaspot-01-application.js
This file contains 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
(function(){ | |
var client_id = '451cf9fc4a0a44379d699e4ca48d58fb'; | |
var app = angular.module('instaspot', []); | |
app.factory("InstagramAPI", ['$http', function($http) { | |
return { | |
fetchPopular: function(callback){ | |
var endpoint = "https://api.instagram.com/v1/media/popular"; | |
endpoint += "?count=99"; | |
endpoint += "&client_id=" + client_id; | |
endpoint += "&callback=JSON_CALLBACK"; | |
$http.jsonp(endpoint).success(function(response){ | |
callback(response.data); | |
}); | |
} | |
} | |
}]); | |
app.controller('ShowImages', function($scope, InstagramAPI){ | |
$scope.data = {}; | |
InstagramAPI.fetchPopular(function(data){ | |
$scope.pics = data; | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment