Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b068c8b

Browse files
wesleychovojtajina
authored andcommitted
docs($resource): fix example using promise
1 parent ec16352 commit b068c8b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/ngResource/resource.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function shallowClearAndCopy(src, dst) {
253253
254254
```js
255255
var User = $resource('/user/:userId', {userId:'@id'});
256-
var user = User.get({userId:123}, function() {
256+
User.get({userId:123}, function(user) {
257257
user.abc = true;
258258
user.$save();
259259
});
@@ -273,6 +273,16 @@ function shallowClearAndCopy(src, dst) {
273273
});
274274
});
275275
```
276+
*
277+
* You can also access the raw `$http` promise via the `$promise` property on the object returned
278+
*
279+
```
280+
var User = $resource('/user/:userId', {userId:'@id'});
281+
User.get({userId:123})
282+
.$promise.then(function(user) {
283+
$scope.user = user;
284+
});
285+
```
276286
277287
* # Creating a custom 'PUT' request
278288
* In this example we create a custom method on our resource to make a PUT request

0 commit comments

Comments
 (0)