javascript - Angular form validation seems to add class of ng-xx-required whether input is required or not? -
when input required, ng-invalid-required
added class , required="required"
being set attribute.
when input not required, ng-valid-required
added class , no required attribute being set attribute.
(a way add required input, through setting variable on scope , using ng-required
per plunkr.)
here plunkr example 1 required input , 1 non required input
what struggling trying find specific documentation on ng-valid-required
. feel confused why there's class ng-xx-required, when input not required.
thanks in advance time. rock on!
it working solution:
<input type="text" name="username" ng-model="user.name" ng-required="required">
the problem pearhaps in variable definition see plunker here: http://plnkr.co/edit/dbcwdeukjq8zp1b3daov?p=preview
Comments
Post a Comment