Improve this Doc View Source ngMaxlength
From Get docs
< Directive components in ngAngularjs/docs/1.8/api/ng/directive/ngmaxlength
Improve this Doc View Source ngMaxlength
- directive in module ng
Overview
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 AngularJS expression given in the ngMaxlength attribute value.
Note: This directive is also added when the plain maxlength attribute is used, with two differences:
ngMaxlengthdoes not set themaxlengthattribute and therefore HTML5 constraint validation is not available.- The
ngMaxlengthattribute must be an expression, while themaxlengthvalue must be interpolated.
Directive Info
- This directive executes at priority level 0.
Usage
as attribute:
<ANY ng-maxlength="expression"> ... </ANY>
Arguments
| Param | Type | Details |
|---|---|---|
| ngMaxlength | expression
|
AngularJS expression that must evaluate to a Number or String parsable into a Number. Used as value for the maxlength validator.
|
Example
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 3.0.
https://code.angularjs.org/1.8.2/docs/api/ng/directive/ngMaxlength