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

Modified state gets screwed when a subform is toggled #57

Open
sakovias opened this issue Sep 22, 2017 · 1 comment
Open

Modified state gets screwed when a subform is toggled #57

sakovias opened this issue Sep 22, 2017 · 1 comment

Comments

@sakovias
Copy link

sakovias commented Sep 22, 2017

Hi @slavafomin, that's a great library, really liking it.

Here's an issue I came across when working with "nested" forms. I've checked that it occurs on versions 2.3.2 and 2.4.2 (possibly others). I have a form with a nested ng-form, the former gets toggled with ng-if. It looks like I can trick it into a "modified" state.

Here's the Plunker: https://plnkr.co/edit/YuYuG6M3SGWYiFE3jBKa?p=preview.

  • Start with a form with selected checkbox "B":

modified_1

  • Select option "foo" in the sub-form. The form is modified as expected:

modified_2

  • Unselect checkbox "B". The form is still modified:

modified_3

  • Select option "B" again. The form values are now different from the starting ones, but it's no longer marked as modified:

modified_4

Please let me know if there's a workaround and/or fix. Appreciate your help!

@sakovias
Copy link
Author

There's a workaround to reset the subform to a "default" state. In the case of the above example, we can clear the subform when the box B is unchecked. We're going loose the state of the subform, but the modified flag will stay correct.

https://plnkr.co/edit/UiV4iJGLLr611gweWxHj?p=preview

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