Created
May 26, 2014 03:54
-
-
Save Tasemu/39943f4e0ded38a5982b to your computer and use it in GitHub Desktop.
Consuming a rest interface using $resource
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
app.controller('UserCtrl', ['$scope', 'User', function ($scope, User) { | |
User.query().$promise.then(function (users) { | |
console.log(users[0]); | |
}); | |
}]); |
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
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