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

fix($resource): Always return a resource instance when calling class met... #5061

Closed
wants to merge 1 commit into from

Conversation

tbosch
Copy link
Contributor

@tbosch tbosch commented Nov 21, 2013

...hods on resources.

Previously, calling MyResource.save(myResourceInstance)returned
a promise, in contrast to the docs for $resource. However,
calling MyResource.save({name: 'Tobias"})already correctly
returned a resource instance.

Fixes #4545.


$httpBackend.expect('POST', '/Person').respond('\n{\n"name":\n"misko2"\n}\n');
var person2 = Person.save(person);
expect(person2 instanceof Person).toBe(true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semi-colon

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be

expect(person2).toEqual(jasmine.any(Person));

@petebacondarwin
Copy link
Member

Other than changing the test description, as you suggest and my comments above, this looks good to me.

…methods on resources.

Previously, calling `MyResource.save(myResourceInstance)`returned
a promise, in contrast to the docs for `$resource`. However,
calling `MyResource.save({name: 'Tobias"})`already correctly
returned a resource instance.

Fixes angular#4545.
@tbosch
Copy link
Contributor Author

tbosch commented Nov 21, 2013

Hi Pete, thanks for your comments. Changed it accordingly.

@tbosch tbosch closed this in f6ecf9a Nov 21, 2013
@tbosch tbosch deleted the resource-class-method branch November 21, 2013 17:51
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
…methods on resources.

Previously, calling `MyResource.save(myResourceInstance)`returned
a promise, in contrast to the docs for `$resource`. However,
calling `MyResource.save({name: 'Tobias"})`already correctly
returned a resource instance.

Fixes angular#4545.
Closes angular#5061.
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
…methods on resources.

Previously, calling `MyResource.save(myResourceInstance)`returned
a promise, in contrast to the docs for `$resource`. However,
calling `MyResource.save({name: 'Tobias"})`already correctly
returned a resource instance.

Fixes angular#4545.
Closes angular#5061.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants