Skip to content

Instantly share code, notes, and snippets.

@mager
Created August 23, 2014 03:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mager/3f4b9dc5b4db10e30434 to your computer and use it in GitHub Desktop.
Save mager/3f4b9dc5b4db10e30434 to your computer and use it in GitHub Desktop.
instaspot-01-application.js
(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