diff options
| author | Wesley Cho | 2014-01-27 22:59:10 -0500 | 
|---|---|---|
| committer | Brian Ford | 2014-03-13 16:33:38 -0700 | 
| commit | 91ef3a31a0080de2b5a3db8f2a20dba00dcd2ae1 (patch) | |
| tree | c96fadb62d33c5ab756b02444efe9f90b007a25e /src/ngResource/resource.js | |
| parent | cea44b3e861e070a857f7a962ed600ace3678798 (diff) | |
| download | angular.js-91ef3a31a0080de2b5a3db8f2a20dba00dcd2ae1.tar.bz2 | |
docs($resource): fix example using promise
Diffstat (limited to 'src/ngResource/resource.js')
| -rw-r--r-- | src/ngResource/resource.js | 12 | 
1 files changed, 11 insertions, 1 deletions
| diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 66433736..8927a266 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -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 | 
