This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

MaxLengthValidator

A directive which installs the MaxLengthValidator for any formControlName, formControl, or control with ngModel that also has a maxlength attribute.

NgModules

Selectors

Properties

Property Description
@Input()
maxlength: string

Methods

ngOnChanges(changes: SimpleChanges): void
      
      ngOnChanges(changes: SimpleChanges): void
    

Parameters

changes

Type: SimpleChanges.

Returns

void

validate(control: AbstractControl): ValidationErrors | null
      
      validate(control: AbstractControl): ValidationErrors | null
    

Parameters

control

Type: AbstractControl.

Returns

ValidationErrors | null

registerOnValidatorChange(fn: () => void): void
      
      registerOnValidatorChange(fn: () => void): void
    

Parameters

fn

Type: () => void.

Returns

void