Angular forms MaxLengthValidator Directive Last Updated : 03 Jun, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: ReactiveFormsModuleFormsModule Selectors: [maxlength] [formControlName][maxlength] [formControl][maxlength] [ngModel] Approach: Create the Angular app to be usedIn app.component.html set maxLength to input so when you are putting data in that input element you cannot exceed the max constantly.Serve the angular app using ng serve to see the output. Example: app.component.html <span>GeeksforGeeks</span> <input type="text" maxlength="12"> <input maxlength="5"> Output: Reference: https://angular.io/api/forms/MaxLengthValidator Comment More infoAdvertise with us Next Article Angular forms MaxLengthValidator Directive T taran910 Follow Improve Article Tags : Web Technologies AngularJS AngularJS-Directives Angular10 Similar Reads AngularJS ng-maxlength Directive The ng-maxlength Directive in AngularJS is used to set the maximum length for an input field i.e it adds the restriction for an input field. It is different from maxlength attribute in HTML because the former prevents users from exceeding the limit whereas the later doesn't do that. It will make the 2 min read AngularJS ng-form Directive The ng-form Directive in AngularJS is used to create a nested form i.e. one form inside the other form. It specifies an inherit control from the HTML form. It creates a control group inside a form directive which can be used to determine the validity of a sub-group of controls. Syntax: <ng-form [ 1 min read AngularJS ng-focus Directive The ng-focus Directive in AngluarJS is used to apply custom behavior when an element is focused. It can be used to show/hide some element or it can pop up an alert when an element is being focused. It is supported by <a>, <input>, <select> and <textarea> elements. Syntax: 1 min read AngularJS ng-pattern Directive The ng-pattern Directive in AngularJS is used to add up pattern (regex pattern) validator to ng-Model on an input HTML element. It is used to set the pattern validation error key if input field data does not match a RegExp that is found by evaluating the Angular expression specified in the ng-patter 2 min read AngularJS ng-transclude Directive The ng-transclude directive is used to mark the insertion point for transcluded DOM of the nearest parent that uses transclusion. Use transclusion slot name as the value of ng-transclude or ng-transclude-slot attribute. If the transcluded content has more than one DOM node with the whitespace text n 3 min read Like