Angular.js multiple inputs in ng-repeat validation conditions

I got it all working fine, except one thing. I need myForm to be $valid = true if

  • all inputs are filled
  • no inputs are filled

and $valid = false if

  • some, but not all, inputs are filled

Note this is all inside an ng-repeat and an ng-form subform.

How would I do it? Is there any way?

Simply add the ng-required directive to all fields in myForm.

E.g. <input type="text" name="myInput" ng-required="isRequired()" />.

The isRequired function should then simply return true if at least one of the form fields contains a value, otherwise false.

If this doesn't work, then there's information you've left out - so in that case please provide more information about your HTML and JS code (I'm only mentioning this because I see you've tagged the question with ng-repeat, which might make the scenario slightly different than the vanilla one you've described in your question).