Last active
August 29, 2015 14:11
-
-
Save danielfriis/7d2d11cfabf6f7f6feb6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
.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