Open In App

Angular forms MaxLengthValidator Directive

In this article, we are going to see what is MaxLengthValidator in Angular 10 and how to use it.
The MaxLengthValidator is used to synchronize a standalone FormControl instance to a form control element

<input maxLength ="number">

Exported from:



Selectors:

Approach: 



 

Example:




<span>GeeksforGeeks</span>
<input type="text" maxlength="12">
<input maxlength="5">

Output:

Reference: https://angular.io/api/forms/MaxLengthValidator

Article Tags :