Skip to content

Latest commit

 

History

History
57 lines (52 loc) · 1.58 KB

Validators.md

File metadata and controls

57 lines (52 loc) · 1.58 KB

Validators

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

var loginControl = new FormControl("", Validators.required)

Static Members

static min(min: number): ValidatorFn

Validator that requires controls to have a value greater than a number

static max(max: number): ValidatorFn

Validator that requires controls to have a value less than a number.

static required(control: AbstractControl): ValidationErrors | null

Validator that requires controls to have a non-empty value.

static requiredTrue(control: AbstractControl): ValidationErrors | null

Validator that requires control value to be true.

static email(control: AbstractControl): ValidationErrors | null

Validator that performs email validation.

static minLength(minLength: number): ValidatorFn

Validator that requires controls to have a value of a minimum length.

static maxLength(maxLength: number): ValidatorFn

Validator that requires controls to have a value of a maximum length.

static pattern(pattern: string | RegExp): ValidatorFn

Validator that requires a control to match a regex to its value.



Note: This document is a derivative of "Validators Document" by Google, under CC BY.