formly-js / angular-formly

JavaScript powered forms for AngularJS
http://docs.angular-formly.com
MIT License
2.22k stars 405 forks source link

When using nested (not-flat) models the model must be updated property by property #577

Closed tuckerjt07 closed 8 years ago

tuckerjt07 commented 8 years ago

The issue that I am having is that I cannot assign a 1-1 match model to the vm.model object to update values. Instead I must iterate over the model and assign each updated property on a property by property basis. Here is the link to the issue on Stack Overflow: http://stackoverflow.com/questions/34169799/angular-formly-nested-model-not-updating

benoror commented 8 years ago

Hi @tuckerjt07! Thanks for your interest in angular-formly. I'm sure that angular-formly can do this for you. The best way to get help is by following the instructions here: http://help.angular-formly.com

I'm going to go ahead and close this issue because the github issues for this project are reserved for bug reports and feature requests. See you on chat! Thanks!

benoror commented 8 years ago

I saw you replaced the model for each key, therefore you never saw the changes.

What you need to do is to match the model in the key itself.

See corrected example: http://jsbin.com/pupijoc/1/edit?js,console,output

benoror commented 8 years ago

Answered in SO: http://stackoverflow.com/a/34185058/171809

tuckerjt07 commented 8 years ago

Can we reopen this? This is either a bug or a feature request as we discussed at the end of the SO conversation. It's not really been answered in line with how the formly documentation reads.

tuckerjt07 commented 8 years ago

@benoror @kentcdodds and I discussed this and I had a disconnect where I did not realize that model was creating an isolated instance when used. Sorry, this can be closed.