docs($resource): fix example using promise

This commit is contained in:
Wesley Cho
2014-01-27 22:59:10 -05:00
committed by Brian Ford
parent cea44b3e86
commit 91ef3a31a0

View File

@@ -253,7 +253,7 @@ function shallowClearAndCopy(src, dst) {
```js
var User = $resource('/user/:userId', {userId:'@id'});
var user = User.get({userId:123}, function() {
User.get({userId:123}, function(user) {
user.abc = true;
user.$save();
});
@@ -273,6 +273,16 @@ function shallowClearAndCopy(src, dst) {
});
});
```
*
* You can also access the raw `$http` promise via the `$promise` property on the object returned
*
```
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123})
.$promise.then(function(user) {
$scope.user = user;
});
```
* # Creating a custom 'PUT' request
* In this example we create a custom method on our resource to make a PUT request