linkMaxLengthValidator
| npm Package | @angular/forms |
|---|---|
| Module | import { MaxLengthValidator } from '@angular/forms'; |
| Source | forms/src/directives/validators.ts |
linkOverview
@Directive({
selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]',
providers: [MAX_LENGTH_VALIDATOR],
host: { '[attr.maxlength]': 'maxlength ? maxlength : null' }
})
class MaxLengthValidator implements Validator, OnChanges {
maxlength: string
ngOnChanges(changes: SimpleChanges): void
validate(c: AbstractControl): ValidationErrors | null
registerOnValidatorChange(fn: () => void): void
}
linkSelectors
[maxlength][formControlName]
[maxlength][formControl]
[maxlength][ngModel]
linkInputs
maxlength bound to MaxLengthValidator.maxlength
linkDescription
A directive which installs the MaxLengthValidator for any formControlName,formControl, or control withngModelthat also has amaxlength` attribute.
linkMembers
maxlength: string
ngOnChanges(changes: SimpleChanges): void
validate(c: AbstractControl): ValidationErrors | null