AngularJS ng-minlength-instructie
Definitie en gebruik
ng-minlength
Instructie om beperkingen toe te voegen aan de validator van de invoervelden en formulieren.
If the length of the value of the input field is less than the specified length,ng-minlength
The directive will add an 'invalid' status.
Note:If the value is empty, it is considered valid.
Example
If the input value is less than five characters, an error is displayed:
<form name="myForm"> <input name="myInput" ng-model="myInput" ng-minlength="5"> <h1 ng-if="!myForm.myInput.$valid">Too short value</h1> </form>
Syntax
<input type="text" ng-minlength="number"></input>
Mainly by text types <input>
Element supported, but can also be used for other elements that allow user input.
Parameter
Parameter | Description |
---|---|
number | A getal dat de minste aantal tekens aangeeft die een invoerveld toestaat. |