I have three input fields on the form. I am looking for a way in which a form is valid if any or any combination of inputs is required. This means that at least one is needed. Also, the user can enter the entered data in any combination, even then the form is also valid.
I read ng-required, but that will make my expression too long.
<td>Name</td>
<td><input type="text" class="form-control input-xs" name="name"
ng-model="ctrl.orderSearch.name" minlength="4">
</td>
<td>Class</td>
<td><input type="text" class="form-control input-xs" name="class"
ng-model="ctrl.orderSearch.Class" minlength="6">
</td>
<td>Roll No:</td>
<td><input type="text" class="form-control input-xs" name="rollNo"
ng-model="ctrl.orderSearch.RollNo" minlength="6">
</td>
Update: I do not want the disable send button. The form is valid in any of these scenarios:
1) the field is filled with one or two or three
2) 1.2 or 1.3 or 2.3 filled
3) 1,2,3 is filled.
, :
ng-required = "! (ctrl.orderSearch.name.length || ctrl.orderSearch.rollNo.length)" . , angular ", ", , . $Valid , . , - .
, . ng-required? , .