![]() |
VOOZH | about |
The ng-minlength Directive in AngularJS is used to set the minimum length for an input field i.e it adds the restriction for an input field. It is different from minlength attribute in HTML because the former prevents users from entering less than the specified limit whereas the later doesn't do that. It makes the form invalid if the entered input is less than the specified limit.
Syntax:
<element ng-minlength="expression"> content... </element>
Parameter:
Example 1: This example uses the ng-minlength Directive to set the minimum length of the string.
Output:
Example 2: In this example, we will render the warning message if the entered character is less than 5 in the input field with the help of the ng-minlength Directive.
Output: