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

Force clone when setting defaults to avoid undesired effect #658

Closed
strets123 opened this issue Apr 1, 2016 · 2 comments
Closed

Force clone when setting defaults to avoid undesired effect #658

strets123 opened this issue Apr 1, 2016 · 2 comments

Comments

@strets123
Copy link

When the default value for a form is set there does not appear to be an angular.copy statement.

This means that if the default value is an array or object, it is possible for the underlying default of the form to be changed by user input to the form leading to undesired behaviour.

In my application I combat this by running angular.copy on the schema (which comes from a provider) each time I load a form into the page but this seems a little wasteful. Is there any documentation to clarify how to approach defaults when creating add ons?

@Anthropic Anthropic changed the title Why not angular.copy when setting defaults? Force clone when setting defaults to avoid undesired effect Apr 3, 2016
@Anthropic
Copy link
Member

@strets123 this is a known issue #407 and #505 are both going to require this to change which is why I will mark this as a duplicate, but if they don't cover what you are asking please re-open. Regarding the add-on behaviour for defaults, there isn't any specific documentation on that at the moment, we are always open to documentation pull requests, also you can usually get some more in depth info through the Gitter if David is around.

FYI we are in the middle of separating the core application into an es6 framework independant core so that this tool can leverage that while react and other frameworks can do the same which is why progress seems to have slowed.

@strets123
Copy link
Author

Thanks for the explanation and sorry for not searching previous issues carefully enough. Makes sense to concentrate on es6. Cheers.

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

No branches or pull requests

2 participants