Skip to content

Instantly share code, notes, and snippets.

@Tasemu
Created May 26, 2014 03:54
Show Gist options
  • Save Tasemu/39943f4e0ded38a5982b to your computer and use it in GitHub Desktop.
Save Tasemu/39943f4e0ded38a5982b to your computer and use it in GitHub Desktop.
Consuming a rest interface using $resource
app.controller('UserCtrl', ['$scope', 'User', function ($scope, User) {
User.query().$promise.then(function (users) {
console.log(users[0]);
});
}]);
app.factory('User', ['$resource', function ($resource) {
return $resource("/user/:id", {id: '@id'}, {
"update": {method: "PUT"}
});
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment