ngMaxlength adds the maxlength validator
to ngModel
. It is most often used for text-based input
controls, but can also be applied to custom text-based controls.
The validator sets the maxlength
error key if the ngModel.$viewValue
is longer than the integer obtained by evaluating the Angular expression given in the ngMaxlength
attribute value.
maxlength
attribute is used, with two differences: ngMaxlength
does not set the maxlength
attribute and therefore HTML5 constraint validation is not available. ngMaxlength
attribute must be an expression, while the maxlength
value must be interpolated. <ng-maxlength> ... </ng-maxlength>
<ANY> ... </ANY>
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.5.11/docs/api/ng/directive/ngMaxlength