AngularJS | ng-minlength Directive
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 prevent 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.
<element ng-minlength="expression"> content ... </element>
Where expression is a number denoting the minimum limit below which the input is invalid.
Example: This example uses ng-minlength Directive to set the minimum length of string.
Before clicking the button:
After clicking the button: