Skip to content

Instantly share code, notes, and snippets.

@danielfriis
Last active August 29, 2015 14:11
Show Gist options
  • Save danielfriis/7d2d11cfabf6f7f6feb6 to your computer and use it in GitHub Desktop.
Save danielfriis/7d2d11cfabf6f7f6feb6 to your computer and use it in GitHub Desktop.
.service('Shots', ['$http', 'Auth', function($http, Auth) {
var accessToken = Auth.getAccessToken();
return {
all: function(list, page) {
return $http.get('http://api.dribbble.com/v1/shots/?list=' + list + "&access_token=" + accessToken + "&page=" + page + "&per_page=10);
},
isLiked: function(shotId) {
return $http.get('https://api.dribbble.com/v1/shots/' + shotId + '/like?access_token=' + accessToken).success(function (data) {
if(shot_id == data.id) {
return true
} else {
return false
}
}).error(function(){
return false
});
}
}
}])
.controller('PopularCtrl', function($scope, Shots, Auth) {
$scope.isLiked = function(shot_id) {
Shots.isLiked(shot_id);
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment