-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Fixing possible bug in initialization of value #4545
Conversation
Thanks for the PR!
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
@sanyax7 - Can you provide a unit test that demonstrates this problem that you are fixing? Also can you ensure that you have signed the CLA? |
I made a plunker that illustrates this regression. |
Hello @smashercosmo, I looked at your example. It shows that calling So you would expect calling |
I looked at your PR also. This is the first step, but we also need to set
This change was introduced by this commit: 05772e1 |
I created a pull request for this that also includes a test. Thanks for filing this PR! |
yes, this is the exact behaviour, that I expect P.S. Thanks for proper PR |
…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.
Thank you for fixing this :) |
…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.
…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.
Hello, I think I found a bug in initialisation of
value
value inangular-resource.js
.I tried to fetch a Json array from my Api server and was getting the following error:
I compared code from
v1.0.6
(which is working okay) with the code fromv1.2.0-rc.3
and found the following difference:And indeed,
data
is the second parameter to theResource[name] = function(a1, a2, a3, a4)
which is called fromResource.prototype['$' + name] = function(params, success, error)
as:So
this
in the scope ofResource.prototype
will, presumably, be always instance ofResource
andvar isInstanceCall = data instanceof Resource;
will be always set to true.I am, most likely, wrong, but the following change fixed my problem. I think it is worth for someone from the team to take a look at what is going in there.