-
Notifications
You must be signed in to change notification settings - Fork 840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PUT not putting changes when model is get through $object #579
Comments
Hey, Thanks for the report! Can you provide a plunkr or jsfiddle with an example? You can use http://angularjstalk.apiary.io/movies API as an example. |
I make a jsfiddle http://jsfiddle.net/jAy4n/ but http://angularjstalk.apiary.io/movies don't accept /GET http://angularjstalk.apiary.io/movies/1 So the jsfiddle is incomplete. |
I also faced same issue and created an example at http://jsfiddle.net/merlinran/8fvGh/ http://jsonplaceholder.typicode.com/ is a great API for test. |
Can this please get bumped? It's kind of a big bug. |
+1 |
8 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
The fault is the following line 890
When the extend(or even merge) function is used to push the restangular response data into the filledValue it breaks the bindData for the put function. maybe a callback function could be implemented to simply replace the empty object {} with the data rather than push it with extend |
To try and explain what I was trying to say here is two examples. First if I manually do what $object does which results and the put containing the original data and not work.
The Second is the same result on the front end but makes the save work.
|
Someone with a bit more knowledge might come up with a better solution but my pull request #1091 fixed the problem for me. Based off @gonzofish .restanularizeElement solution from issue #713 |
Based on @garhbod's pull request, but without modifying restangular itself, I came up with this quick fix:
|
@peter-bertuglia does that account for data that might be from the server but hasn't been Restangularized? |
@gonzofish I'm not sure what you mean by "might be from the server," this code is Restangularizing the object that is definitely coming from the server, it's intercepting the response |
Sorry, my fault. I read the code the wrong way...thought it was a request interceptor...stupid me. |
I am still experiencing the same issue, it looks like it's been there for a while now... Truly yours, a coder in pain ;) |
yet another +1 |
+1 |
@peter-bertuglia Great !! Here is an upgrade handling collections as well as element.
EDITThere were too much codes.. this is well enough :
With the previous version, if you did a Restangular.extendModel, you received twice each resource instead of once. And when working with events, those were triggered twice.. Bye ! |
restanglar v1.3.1
It will not put the changes.
But if get through promise it will work.
The text was updated successfully, but these errors were encountered: