Reputation: 25
When using a form in angular, if the scope is all on "one level", I can use a watch on the form variable in the controller to see when the validation has changed: http://plnkr.co/edit/s4s2FeRDc6hEJHUqQLZO?p=preview (watch in the console)
However, if an ng-include is used, this seems to break the watch: http://plnkr.co/edit/YFx22DiB0WA9UyNa80kR?p=preview
It seems that the isolated scope breaks things, or, more likely, I have... How can I make this work?
Thanks,
Mat
Upvotes: 1
Views: 195
Reputation: 7820
Move your ng-controller="form"
to the ng-form
element instead of having it declared in the element with ng-include
. It seems ng-include
creates an isolated scope for the inner component, thus the form will not be visible to the outside.
Edit: typo
Upvotes: 1