Class Overview
class Validators {staticrequired(control: AbstractControl) : {[key: string]: boolean}
staticrequiredTrue(control: AbstractControl) : {[key: string]: boolean}
staticminLength(minLength: number) : ValidatorFn
staticmaxLength(maxLength: number) : ValidatorFn
staticpattern(pattern: string|RegExp) : ValidatorFn
staticnullValidator(c: AbstractControl) : {[key: string]: boolean}
staticcompose(validators: ValidatorFn[]) : ValidatorFn
staticcomposeAsync(validators: AsyncValidatorFn[]) : AsyncValidatorFn
}
Class Description
Provides a set of validators used by form controls.
A validator is a function that processes a FormControl or collection of
controls and returns a map of errors. A null map means that validation has passed.
Example
Static Members
required(control: AbstractControl) : {[key: string]: boolean}Validator that requires controls to have a non-empty value.
requiredTrue(control: AbstractControl) : {[key: string]: boolean}Validator that requires control value to be true.
minLength(minLength: number) : ValidatorFnValidator that requires controls to have a value of a minimum length.
maxLength(maxLength: number) : ValidatorFnValidator that requires controls to have a value of a maximum length.
pattern(pattern: string|RegExp) : ValidatorFnValidator that requires a control to match a regex to its value.
nullValidator(c: AbstractControl) : {[key: string]: boolean}No-op validator.
compose(validators: ValidatorFn[]) : ValidatorFnCompose multiple validators into a single function that returns the union of the individual error maps.
composeAsync(validators: AsyncValidatorFn[]) : AsyncValidatorFn
exported from @angular/forms/index, defined in @angular/forms/src/validators.ts