feat(forms): expose ValidatorFn and AsyncValidatorFn

Closes #8834
This commit is contained in:
Kara Erickson 2016-06-24 18:24:11 -07:00
parent 40b907a657
commit 17dcbf66b9
2 changed files with 12 additions and 1 deletions

View File

@ -38,8 +38,9 @@ export {FormControlName} from './directives/reactive_directives/form_control_nam
export {FormGroupDirective} from './directives/reactive_directives/form_group_directive';
export {FormGroupName} from './directives/reactive_directives/form_group_name';
export {NgSelectOption, SelectControlValueAccessor} from './directives/select_control_value_accessor';
export {MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, Validator} from './directives/validators';
export {AsyncValidatorFn, MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, Validator, ValidatorFn} from './directives/validators';
export {FormBuilder} from './form_builder';
export {AbstractControl, FormArray, FormControl, FormGroup} from './model';
export {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from './validators';
export * from './form_providers';

View File

@ -58,6 +58,10 @@ export declare abstract class AbstractControlDirective {
valueChanges: Observable<any>;
}
export interface AsyncValidatorFn {
(c: AbstractControl): any;
}
export declare class CheckboxControlValueAccessor implements ControlValueAccessor {
onChange: (_: any) => void;
onTouched: () => void;
@ -327,6 +331,12 @@ export interface Validator {
};
}
export interface ValidatorFn {
(c: AbstractControl): {
[key: string]: any;
};
}
export declare class Validators {
static compose(validators: ValidatorFn[]): ValidatorFn;
static composeAsync(validators: AsyncValidatorFn[]): AsyncValidatorFn;