Skip to content
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

Set() with complex JSON overwrites rather than updating nested attributes #135

Open
akshaddhoke opened this issue Apr 24, 2015 · 0 comments

Comments

@akshaddhoke
Copy link

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant