feat(forms): add email validator (#13709)

Closes #13706

PR Close #13709
This commit is contained in:
Dzmitry Shylovich
2016-12-29 20:07:02 +03:00
committed by Miško Hevery
parent 00979838ef
commit d69717cf79
7 changed files with 120 additions and 2 deletions

View File

@ -150,6 +150,15 @@ export declare class DefaultValueAccessor implements ControlValueAccessor {
writeValue(value: any): void;
}
/** @experimental */
export declare class EmailValidator implements Validator {
email: boolean | string;
registerOnValidatorChange(fn: () => void): void;
validate(c: AbstractControl): {
[key: string]: any;
};
}
/** @stable */
export interface Form {
addControl(dir: NgControl): void;
@ -529,6 +538,9 @@ export interface ValidatorFn {
export declare class Validators {
static compose(validators: ValidatorFn[]): ValidatorFn;
static composeAsync(validators: AsyncValidatorFn[]): AsyncValidatorFn;
static email(control: AbstractControl): {
[key: string]: boolean;
};
static maxLength(maxLength: number): ValidatorFn;
static minLength(minLength: number): ValidatorFn;
static nullValidator(c: AbstractControl): {