betsol / angular-input-modified

Angular.js module to detect and indicate input modifications
90 stars 35 forks source link

Modified state gets screwed when a subform is toggled #57

Open sakovias opened 7 years ago

sakovias commented 7 years ago

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.

modified_1

modified_2

modified_3

modified_4

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

sakovias commented 7 years ago

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