How can I skip validation of nested forms with AngularJS? I have to make an outer form valid even when its child form is invalid.
In the example below outer form sh
In Angular forms can be nested. This means that the outer form is valid when all of the child forms are valid as well.
So there is no way to make outer form to be valid automatically (through $valid
key) when one of inner invalid.
Try to use error.required
Outer form (valid={{!fOuter.txtOuter.$error.required}})
Demo Fiddle
From Angular ngForm docs:
The other way should be to use controller, like:
Outer form (valid={{isOuterFormValid}})
controller
$scope.isOuterFormValid = true;
// here, add listener on each input and change flag `isOuterFormValid`
...