feat(forms): introduce min and max validators (#15813)

PR Close #15813
This commit is contained in:
Toxicable
2017-04-06 09:41:10 -06:00
committed by Miško Hevery
parent 6e2abcd5fc
commit 81925fa66d
7 changed files with 293 additions and 2 deletions
+18
View File
@@ -352,6 +352,14 @@ export declare class MaxLengthValidator implements Validator, OnChanges {
validate(c: AbstractControl): ValidationErrors | null;
}
/** @experimental */
export declare class MaxValidator implements Validator, OnChanges {
max: string;
ngOnChanges(changes: SimpleChanges): void;
registerOnValidatorChange(fn: () => void): void;
validate(c: AbstractControl): ValidationErrors | null;
}
/** @stable */
export declare class MinLengthValidator implements Validator, OnChanges {
minlength: string;
@@ -360,6 +368,14 @@ export declare class MinLengthValidator implements Validator, OnChanges {
validate(c: AbstractControl): ValidationErrors | null;
}
/** @experimental */
export declare class MinValidator implements Validator, OnChanges {
min: string;
ngOnChanges(changes: SimpleChanges): void;
registerOnValidatorChange(fn: () => void): void;
validate(c: AbstractControl): ValidationErrors | null;
}
/** @stable */
export declare const NG_ASYNC_VALIDATORS: InjectionToken<(Function | Validator)[]>;
@@ -536,7 +552,9 @@ export declare class Validators {
static compose(validators: (ValidatorFn | null | undefined)[]): ValidatorFn | null;
static composeAsync(validators: (AsyncValidatorFn | null)[]): AsyncValidatorFn | null;
static email(control: AbstractControl): ValidationErrors | null;
static max(max: number): ValidatorFn;
static maxLength(maxLength: number): ValidatorFn;
static min(min: number): ValidatorFn;
static minLength(minLength: number): ValidatorFn;
static nullValidator(c: AbstractControl): ValidationErrors | null;
static pattern(pattern: string | RegExp): ValidatorFn;