angular/angular.js — pull request #2607 by vojtajina (2013-05-08 03:26:47+00:00)
Title: $resource with promises

This is just finishing https://github.com/angular/angular.js/pull/2060.

My changes, that will get squashed into the first commit:

- change `.$resolved` to be boolean (true/false), rather than undefined/true
- keep the original promise (do not update `.$promise` after subsequent instance calls)
- success callbacks gets response (with value as `.resource`), instead of direct value (this is just reverting to the original behavior of $resource)
- docs: reflect these changes
- some style/formatting (reverting trailing white spaces, etc.)

### Passsing whole response into the promise:
I did this, because I think it is very helpful to have access to the http response. More than that, people might be already relying on it.
The reason for passing just the value (resource instance) was to simplify $route resolve, but I think it's not that worse (unless I'm missing something):

````javascript
// passing whole response
MyController.resolve = function(MyResource) {
return MyResource.get(...).promise.then(function(response) {
return response.resource;
});
};

// passing direct resource instace
MyController.resolve = function(MyResource) {
return MyResource.get(...).promise;
};
````

Before merging:

- [] squash
- [] add BREAKING CHANGE message