You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Backbone fetch() uses JSON to set the attributes once they are received, which is causing nested attributes to be overwritten rather than being updated.
I am not sure if this is by design, or a bug, but I was expecting the same behavior whether setting the values using '.' or by directly using a complex JSON.
E.g.
model.set('name.firstName','John') ----> only updates firstName of nested name attribute
model.set({name:{firstName:'John'}}); ----> replaces the nested name attribute
Backbone fetch() uses JSON to set the attributes once they are received, which is causing nested attributes to be overwritten rather than being updated.
I am not sure if this is by design, or a bug, but I was expecting the same behavior whether setting the values using '.' or by directly using a complex JSON.
E.g.
model.set('name.firstName','John') ----> only updates firstName of nested name attribute
model.set({name:{firstName:'John'}}); ----> replaces the nested name attribute
JsFiddle: http://jsfiddle.net/c2yjzs2u/1/
The text was updated successfully, but these errors were encountered: