2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class AbstractControl {
|
|
|
|
asyncValidator: AsyncValidatorFn;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly dirty: boolean;
|
|
|
|
readonly disabled: boolean;
|
|
|
|
readonly enabled: boolean;
|
2017-02-23 12:53:29 -05:00
|
|
|
readonly errors: ValidationErrors | null;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly invalid: boolean;
|
|
|
|
readonly parent: FormGroup | FormArray;
|
|
|
|
readonly pending: boolean;
|
|
|
|
readonly pristine: boolean;
|
|
|
|
readonly root: AbstractControl;
|
|
|
|
readonly status: string;
|
|
|
|
readonly statusChanges: Observable<any>;
|
|
|
|
readonly touched: boolean;
|
|
|
|
readonly untouched: boolean;
|
|
|
|
readonly valid: boolean;
|
2016-06-23 21:19:32 -04:00
|
|
|
validator: ValidatorFn;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly value: any;
|
|
|
|
readonly valueChanges: Observable<any>;
|
2016-06-23 21:19:32 -04:00
|
|
|
constructor(validator: ValidatorFn, asyncValidator: AsyncValidatorFn);
|
2016-06-22 17:56:10 -04:00
|
|
|
clearAsyncValidators(): void;
|
|
|
|
clearValidators(): void;
|
2016-08-24 19:58:43 -04:00
|
|
|
disable({onlySelf, emitEvent}?: {
|
|
|
|
onlySelf?: boolean;
|
|
|
|
emitEvent?: boolean;
|
|
|
|
}): void;
|
|
|
|
enable({onlySelf, emitEvent}?: {
|
|
|
|
onlySelf?: boolean;
|
|
|
|
emitEvent?: boolean;
|
|
|
|
}): void;
|
2016-08-01 17:22:50 -04:00
|
|
|
get(path: Array<string | number> | string): AbstractControl;
|
2016-06-23 21:19:32 -04:00
|
|
|
getError(errorCode: string, path?: string[]): any;
|
|
|
|
hasError(errorCode: string, path?: string[]): boolean;
|
2016-06-22 17:56:10 -04:00
|
|
|
markAsDirty({onlySelf}?: {
|
|
|
|
onlySelf?: boolean;
|
|
|
|
}): void;
|
|
|
|
markAsPending({onlySelf}?: {
|
|
|
|
onlySelf?: boolean;
|
|
|
|
}): void;
|
2016-07-12 18:02:25 -04:00
|
|
|
markAsPristine({onlySelf}?: {
|
|
|
|
onlySelf?: boolean;
|
|
|
|
}): void;
|
2016-07-01 18:36:04 -04:00
|
|
|
markAsTouched({onlySelf}?: {
|
|
|
|
onlySelf?: boolean;
|
|
|
|
}): void;
|
2016-07-12 18:02:25 -04:00
|
|
|
markAsUntouched({onlySelf}?: {
|
|
|
|
onlySelf?: boolean;
|
|
|
|
}): void;
|
2016-08-05 16:35:17 -04:00
|
|
|
abstract patchValue(value: any, options?: Object): void;
|
2016-07-12 18:02:25 -04:00
|
|
|
abstract reset(value?: any, options?: Object): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
setAsyncValidators(newValidator: AsyncValidatorFn | AsyncValidatorFn[]): void;
|
2017-02-23 12:53:29 -05:00
|
|
|
setErrors(errors: ValidationErrors | null, {emitEvent}?: {
|
2016-06-22 17:56:10 -04:00
|
|
|
emitEvent?: boolean;
|
|
|
|
}): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
setParent(parent: FormGroup | FormArray): void;
|
|
|
|
setValidators(newValidator: ValidatorFn | ValidatorFn[]): void;
|
2016-08-05 16:35:17 -04:00
|
|
|
abstract setValue(value: any, options?: Object): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
updateValueAndValidity({onlySelf, emitEvent}?: {
|
|
|
|
onlySelf?: boolean;
|
|
|
|
emitEvent?: boolean;
|
|
|
|
}): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class AbstractControlDirective {
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly control: AbstractControl;
|
|
|
|
readonly dirty: boolean;
|
|
|
|
readonly disabled: boolean;
|
|
|
|
readonly enabled: boolean;
|
2017-02-23 12:53:29 -05:00
|
|
|
readonly errors: ValidationErrors | null;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly invalid: boolean;
|
|
|
|
readonly path: string[];
|
|
|
|
readonly pending: boolean;
|
|
|
|
readonly pristine: boolean;
|
|
|
|
readonly statusChanges: Observable<any>;
|
|
|
|
readonly touched: boolean;
|
|
|
|
readonly untouched: boolean;
|
|
|
|
readonly valid: boolean;
|
|
|
|
readonly value: any;
|
|
|
|
readonly valueChanges: Observable<any>;
|
2016-10-19 12:49:02 -04:00
|
|
|
getError(errorCode: string, path?: string[]): any;
|
|
|
|
hasError(errorCode: string, path?: string[]): boolean;
|
2016-07-12 18:02:25 -04:00
|
|
|
reset(value?: any): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-07-07 23:14:42 -04:00
|
|
|
export declare class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly asyncValidator: AsyncValidatorFn;
|
|
|
|
readonly control: FormGroup;
|
|
|
|
readonly formDirective: Form;
|
|
|
|
readonly path: string[];
|
|
|
|
readonly validator: ValidatorFn;
|
2016-07-07 23:14:42 -04:00
|
|
|
ngOnDestroy(): void;
|
|
|
|
ngOnInit(): void;
|
|
|
|
}
|
|
|
|
|
2017-02-20 19:26:51 -05:00
|
|
|
/** @experimental */
|
|
|
|
export interface AsyncValidator extends Validator {
|
2017-02-23 12:53:29 -05:00
|
|
|
validate(c: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>;
|
2017-02-20 19:26:51 -05:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-24 21:24:11 -04:00
|
|
|
export interface AsyncValidatorFn {
|
2017-02-23 12:53:29 -05:00
|
|
|
(c: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>;
|
2016-06-24 21:24:11 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class CheckboxControlValueAccessor implements ControlValueAccessor {
|
|
|
|
onChange: (_: any) => void;
|
|
|
|
onTouched: () => void;
|
|
|
|
constructor(_renderer: Renderer, _elementRef: ElementRef);
|
|
|
|
registerOnChange(fn: (_: any) => {}): void;
|
|
|
|
registerOnTouched(fn: () => {}): void;
|
2016-08-24 19:58:43 -04:00
|
|
|
setDisabledState(isDisabled: boolean): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
writeValue(value: any): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-12-10 05:44:04 -05:00
|
|
|
/** @experimental */
|
|
|
|
export declare class CheckboxRequiredValidator extends RequiredValidator {
|
2017-02-23 12:53:29 -05:00
|
|
|
validate(c: AbstractControl): ValidationErrors | null;
|
2016-12-10 05:44:04 -05:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class ControlContainer extends AbstractControlDirective {
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly formDirective: Form;
|
2016-06-23 21:19:32 -04:00
|
|
|
name: string;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly path: string[];
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface ControlValueAccessor {
|
|
|
|
registerOnChange(fn: any): void;
|
|
|
|
registerOnTouched(fn: any): void;
|
2016-08-24 19:58:43 -04:00
|
|
|
setDisabledState?(isDisabled: boolean): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
writeValue(obj: any): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class DefaultValueAccessor implements ControlValueAccessor {
|
|
|
|
onChange: (_: any) => void;
|
|
|
|
onTouched: () => void;
|
|
|
|
constructor(_renderer: Renderer, _elementRef: ElementRef);
|
|
|
|
registerOnChange(fn: (_: any) => void): void;
|
|
|
|
registerOnTouched(fn: () => void): void;
|
2016-08-24 19:58:43 -04:00
|
|
|
setDisabledState(isDisabled: boolean): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
writeValue(value: any): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-12-29 12:07:02 -05:00
|
|
|
/** @experimental */
|
|
|
|
export declare class EmailValidator implements Validator {
|
|
|
|
email: boolean | string;
|
|
|
|
registerOnValidatorChange(fn: () => void): void;
|
2017-02-23 12:53:29 -05:00
|
|
|
validate(c: AbstractControl): ValidationErrors | null;
|
2016-12-29 12:07:02 -05:00
|
|
|
}
|
|
|
|
|
2016-08-24 00:36:34 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface Form {
|
|
|
|
addControl(dir: NgControl): void;
|
|
|
|
addFormGroup(dir: AbstractFormGroupDirective): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
getControl(dir: NgControl): FormControl;
|
2016-06-22 17:56:10 -04:00
|
|
|
getFormGroup(dir: AbstractFormGroupDirective): FormGroup;
|
2016-06-23 21:19:32 -04:00
|
|
|
removeControl(dir: NgControl): void;
|
|
|
|
removeFormGroup(dir: AbstractFormGroupDirective): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
updateModel(dir: NgControl, value: any): void;
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class FormArray extends AbstractControl {
|
|
|
|
controls: AbstractControl[];
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly length: number;
|
2016-06-22 17:56:10 -04:00
|
|
|
constructor(controls: AbstractControl[], validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn);
|
|
|
|
at(index: number): AbstractControl;
|
2016-08-24 19:58:43 -04:00
|
|
|
getRawValue(): any[];
|
2016-06-22 17:56:10 -04:00
|
|
|
insert(index: number, control: AbstractControl): void;
|
2016-10-19 12:54:54 -04:00
|
|
|
patchValue(value: any[], {onlySelf, emitEvent}?: {
|
2016-08-05 16:35:17 -04:00
|
|
|
onlySelf?: boolean;
|
2016-10-19 12:54:54 -04:00
|
|
|
emitEvent?: boolean;
|
2016-08-05 16:35:17 -04:00
|
|
|
}): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
push(control: AbstractControl): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
removeAt(index: number): void;
|
2016-10-19 12:54:54 -04:00
|
|
|
reset(value?: any, {onlySelf, emitEvent}?: {
|
2016-07-12 18:02:25 -04:00
|
|
|
onlySelf?: boolean;
|
2016-10-19 12:54:54 -04:00
|
|
|
emitEvent?: boolean;
|
2016-07-12 18:02:25 -04:00
|
|
|
}): void;
|
2016-09-02 18:57:35 -04:00
|
|
|
setControl(index: number, control: AbstractControl): void;
|
2016-10-19 12:54:54 -04:00
|
|
|
setValue(value: any[], {onlySelf, emitEvent}?: {
|
2016-07-08 16:04:25 -04:00
|
|
|
onlySelf?: boolean;
|
2016-10-19 12:54:54 -04:00
|
|
|
emitEvent?: boolean;
|
2016-07-08 16:04:25 -04:00
|
|
|
}): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-25 16:27:29 -04:00
|
|
|
export declare class FormArrayName extends ControlContainer implements OnInit, OnDestroy {
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly asyncValidator: AsyncValidatorFn;
|
|
|
|
readonly control: FormArray;
|
|
|
|
readonly formDirective: FormGroupDirective;
|
2016-06-25 16:27:29 -04:00
|
|
|
name: string;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly path: string[];
|
|
|
|
readonly validator: ValidatorFn;
|
2016-06-25 16:27:29 -04:00
|
|
|
constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]);
|
|
|
|
ngOnDestroy(): void;
|
|
|
|
ngOnInit(): void;
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class FormBuilder {
|
2016-06-23 21:19:32 -04:00
|
|
|
array(controlsConfig: any[], validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn): FormArray;
|
2016-08-24 19:58:43 -04:00
|
|
|
control(formState: Object, validator?: ValidatorFn | ValidatorFn[], asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[]): FormControl;
|
2016-06-22 17:56:10 -04:00
|
|
|
group(controlsConfig: {
|
|
|
|
[key: string]: any;
|
|
|
|
}, extra?: {
|
|
|
|
[key: string]: any;
|
|
|
|
}): FormGroup;
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class FormControl extends AbstractControl {
|
2016-08-24 19:58:43 -04:00
|
|
|
constructor(formState?: any, validator?: ValidatorFn | ValidatorFn[], asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[]);
|
2016-08-05 16:35:17 -04:00
|
|
|
patchValue(value: any, options?: {
|
|
|
|
onlySelf?: boolean;
|
|
|
|
emitEvent?: boolean;
|
|
|
|
emitModelToViewChange?: boolean;
|
|
|
|
emitViewToModelChange?: boolean;
|
|
|
|
}): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
registerOnChange(fn: Function): void;
|
2016-08-24 19:58:43 -04:00
|
|
|
registerOnDisabledChange(fn: (isDisabled: boolean) => void): void;
|
2016-10-19 12:54:54 -04:00
|
|
|
reset(formState?: any, {onlySelf, emitEvent}?: {
|
2016-07-12 18:02:25 -04:00
|
|
|
onlySelf?: boolean;
|
2016-10-19 12:54:54 -04:00
|
|
|
emitEvent?: boolean;
|
2016-07-12 18:02:25 -04:00
|
|
|
}): void;
|
2016-08-05 16:35:17 -04:00
|
|
|
setValue(value: any, {onlySelf, emitEvent, emitModelToViewChange, emitViewToModelChange}?: {
|
|
|
|
onlySelf?: boolean;
|
|
|
|
emitEvent?: boolean;
|
|
|
|
emitModelToViewChange?: boolean;
|
|
|
|
emitViewToModelChange?: boolean;
|
|
|
|
}): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class FormControlDirective extends NgControl implements OnChanges {
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly asyncValidator: AsyncValidatorFn;
|
|
|
|
readonly control: FormControl;
|
2016-06-22 17:56:10 -04:00
|
|
|
form: FormControl;
|
2016-08-25 17:56:31 -04:00
|
|
|
isDisabled: boolean;
|
2016-06-22 17:56:10 -04:00
|
|
|
model: any;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly path: string[];
|
2016-06-22 17:56:10 -04:00
|
|
|
update: EventEmitter<{}>;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly validator: ValidatorFn;
|
2016-06-23 21:19:32 -04:00
|
|
|
viewModel: any;
|
2017-02-20 19:26:51 -05:00
|
|
|
constructor(validators: Array<Validator | ValidatorFn>, asyncValidators: Array<AsyncValidator | AsyncValidatorFn>, valueAccessors: ControlValueAccessor[]);
|
2016-06-22 17:56:10 -04:00
|
|
|
ngOnChanges(changes: SimpleChanges): void;
|
|
|
|
viewToModelUpdate(newValue: any): void;
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class FormControlName extends NgControl implements OnChanges, OnDestroy {
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly asyncValidator: AsyncValidatorFn;
|
|
|
|
readonly control: FormControl;
|
|
|
|
readonly formDirective: any;
|
2016-08-25 17:56:31 -04:00
|
|
|
isDisabled: boolean;
|
2016-06-22 17:56:10 -04:00
|
|
|
model: any;
|
2016-06-23 21:19:32 -04:00
|
|
|
name: string;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly path: string[];
|
2016-06-22 17:56:10 -04:00
|
|
|
update: EventEmitter<{}>;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly validator: ValidatorFn;
|
2017-02-20 19:26:51 -05:00
|
|
|
constructor(parent: ControlContainer, validators: Array<Validator | ValidatorFn>, asyncValidators: Array<AsyncValidator | AsyncValidatorFn>, valueAccessors: ControlValueAccessor[]);
|
2016-06-22 17:56:10 -04:00
|
|
|
ngOnChanges(changes: SimpleChanges): void;
|
|
|
|
ngOnDestroy(): void;
|
|
|
|
viewToModelUpdate(newValue: any): void;
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class FormGroup extends AbstractControl {
|
|
|
|
controls: {
|
|
|
|
[key: string]: AbstractControl;
|
|
|
|
};
|
|
|
|
constructor(controls: {
|
|
|
|
[key: string]: AbstractControl;
|
|
|
|
}, validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn);
|
|
|
|
addControl(name: string, control: AbstractControl): void;
|
|
|
|
contains(controlName: string): boolean;
|
2016-11-08 18:44:36 -05:00
|
|
|
getRawValue(): any;
|
2016-08-05 16:35:17 -04:00
|
|
|
patchValue(value: {
|
|
|
|
[key: string]: any;
|
2016-10-19 12:54:54 -04:00
|
|
|
}, {onlySelf, emitEvent}?: {
|
2016-08-05 16:35:17 -04:00
|
|
|
onlySelf?: boolean;
|
2016-10-19 12:54:54 -04:00
|
|
|
emitEvent?: boolean;
|
2016-08-05 16:35:17 -04:00
|
|
|
}): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
registerControl(name: string, control: AbstractControl): AbstractControl;
|
|
|
|
removeControl(name: string): void;
|
2016-10-19 12:54:54 -04:00
|
|
|
reset(value?: any, {onlySelf, emitEvent}?: {
|
2016-07-12 18:02:25 -04:00
|
|
|
onlySelf?: boolean;
|
2016-10-19 12:54:54 -04:00
|
|
|
emitEvent?: boolean;
|
2016-07-12 18:02:25 -04:00
|
|
|
}): void;
|
2016-09-02 18:57:35 -04:00
|
|
|
setControl(name: string, control: AbstractControl): void;
|
2016-08-05 16:35:17 -04:00
|
|
|
setValue(value: {
|
2016-07-08 16:04:25 -04:00
|
|
|
[key: string]: any;
|
2016-10-19 12:54:54 -04:00
|
|
|
}, {onlySelf, emitEvent}?: {
|
2016-07-08 16:04:25 -04:00
|
|
|
onlySelf?: boolean;
|
2016-10-19 12:54:54 -04:00
|
|
|
emitEvent?: boolean;
|
2016-07-08 16:04:25 -04:00
|
|
|
}): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class FormGroupDirective extends ControlContainer implements Form, OnChanges {
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly control: FormGroup;
|
2016-09-02 18:57:35 -04:00
|
|
|
directives: FormControlName[];
|
2016-06-22 17:56:10 -04:00
|
|
|
form: FormGroup;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly formDirective: Form;
|
2016-06-23 21:19:32 -04:00
|
|
|
ngSubmit: EventEmitter<{}>;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly path: string[];
|
|
|
|
readonly submitted: boolean;
|
2016-06-23 21:19:32 -04:00
|
|
|
constructor(_validators: any[], _asyncValidators: any[]);
|
2016-09-02 18:57:35 -04:00
|
|
|
addControl(dir: FormControlName): FormControl;
|
2016-06-25 16:27:29 -04:00
|
|
|
addFormArray(dir: FormArrayName): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
addFormGroup(dir: FormGroupName): void;
|
2016-09-02 18:57:35 -04:00
|
|
|
getControl(dir: FormControlName): FormControl;
|
2016-06-25 16:27:29 -04:00
|
|
|
getFormArray(dir: FormArrayName): FormArray;
|
2016-06-23 21:19:32 -04:00
|
|
|
getFormGroup(dir: FormGroupName): FormGroup;
|
|
|
|
ngOnChanges(changes: SimpleChanges): void;
|
2016-07-12 18:02:25 -04:00
|
|
|
onReset(): void;
|
2016-10-11 18:49:36 -04:00
|
|
|
onSubmit($event: Event): boolean;
|
2016-09-02 18:57:35 -04:00
|
|
|
removeControl(dir: FormControlName): void;
|
2016-06-25 16:27:29 -04:00
|
|
|
removeFormArray(dir: FormArrayName): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
removeFormGroup(dir: FormGroupName): void;
|
2016-08-12 02:27:33 -04:00
|
|
|
resetForm(value?: any): void;
|
2016-09-02 18:57:35 -04:00
|
|
|
updateModel(dir: FormControlName, value: any): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy {
|
|
|
|
name: string;
|
|
|
|
constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]);
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
feat(forms): add modules for forms and deprecatedForms (#9859)
Closes #9732
BREAKING CHANGE:
We have removed the deprecated form directives from the built-in platform directive list, so apps are not required to package forms with their app. This also makes forms friendly to offline compilation.
Instead, we have exposed three modules:
OLD API:
- `DeprecatedFormsModule`
NEW API:
- `FormsModule`
- `ReactiveFormsModule`
If you provide one of these modules, the default forms directives and providers from that module will be available to you app-wide. Note: You can provide both the `FormsModule` and the `ReactiveFormsModule` together if you like, but they are fully-functional separately.
**Before:**
```ts
import {disableDeprecatedForms, provideForms} from @angular/forms;
bootstrap(App, [
disableDeprecatedForms(),
provideForms()
]);
```
**After:**
```ts
import {DeprecatedFormsModule} from @angular/common;
bootstrap(App, {modules: [DeprecatedFormsModule] });
```
-OR-
```ts
import {FormsModule} from @angular/forms;
bootstrap(App, {modules: [FormsModule] });
```
-OR-
```ts
import {ReactiveFormsModule} from @angular/forms;
bootstrap(App, {modules: [ReactiveFormsModule] });
```
You can also choose not to provide any forms module and run your app without forms.
Or you can choose not to provide any forms module *and* provide form directives at will. This will allow you to use the deprecatedForms API for some components and not others.
```
import {FORM_DIRECTIVES, FORM_PROVIDERS} from @angular/forms;
@Component({
selector: some-comp,
directives: [FORM_DIRECTIVES],
providers: [FORM_PROVIDERS]
})
class SomeComp
```
2016-07-07 14:32:51 -04:00
|
|
|
export declare class FormsModule {
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-08-06 02:53:41 -04:00
|
|
|
export declare class MaxLengthValidator implements Validator, OnChanges {
|
|
|
|
maxlength: string;
|
|
|
|
ngOnChanges(changes: SimpleChanges): void;
|
2016-09-09 17:09:11 -04:00
|
|
|
registerOnValidatorChange(fn: () => void): void;
|
2017-02-23 12:53:29 -05:00
|
|
|
validate(c: AbstractControl): ValidationErrors | null;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-08-06 02:53:41 -04:00
|
|
|
export declare class MinLengthValidator implements Validator, OnChanges {
|
|
|
|
minlength: string;
|
|
|
|
ngOnChanges(changes: SimpleChanges): void;
|
2016-09-09 17:09:11 -04:00
|
|
|
registerOnValidatorChange(fn: () => void): void;
|
2017-02-23 12:53:29 -05:00
|
|
|
validate(c: AbstractControl): ValidationErrors | null;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2017-01-03 19:54:46 -05:00
|
|
|
export declare const NG_ASYNC_VALIDATORS: InjectionToken<(Function | Validator)[]>;
|
2016-06-22 17:56:10 -04:00
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2017-01-03 19:54:46 -05:00
|
|
|
export declare const NG_VALIDATORS: InjectionToken<(Function | Validator)[]>;
|
2016-06-22 17:56:10 -04:00
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2017-01-03 19:54:46 -05:00
|
|
|
export declare const NG_VALUE_ACCESSOR: InjectionToken<ControlValueAccessor>;
|
2016-06-22 17:56:10 -04:00
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare abstract class NgControl extends AbstractControlDirective {
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly asyncValidator: AsyncValidatorFn;
|
2016-06-22 17:56:10 -04:00
|
|
|
name: string;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly validator: ValidatorFn;
|
2016-06-23 21:19:32 -04:00
|
|
|
valueAccessor: ControlValueAccessor;
|
2016-06-22 17:56:10 -04:00
|
|
|
abstract viewToModelUpdate(newValue: any): void;
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-08-11 12:01:09 -04:00
|
|
|
export declare class NgControlStatus extends AbstractControlStatus {
|
2016-06-23 21:19:32 -04:00
|
|
|
constructor(cd: NgControl);
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-08-11 12:01:09 -04:00
|
|
|
export declare class NgControlStatusGroup extends AbstractControlStatus {
|
|
|
|
constructor(cd: ControlContainer);
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class NgForm extends ControlContainer implements Form {
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly control: FormGroup;
|
|
|
|
readonly controls: {
|
2016-06-22 17:56:10 -04:00
|
|
|
[key: string]: AbstractControl;
|
|
|
|
};
|
2016-06-23 21:19:32 -04:00
|
|
|
form: FormGroup;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly formDirective: Form;
|
2016-06-23 21:19:32 -04:00
|
|
|
ngSubmit: EventEmitter<{}>;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly path: string[];
|
|
|
|
readonly submitted: boolean;
|
2016-06-23 21:19:32 -04:00
|
|
|
constructor(validators: any[], asyncValidators: any[]);
|
2016-06-22 17:56:10 -04:00
|
|
|
addControl(dir: NgModel): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
addFormGroup(dir: NgModelGroup): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
getControl(dir: NgModel): FormControl;
|
2016-06-23 21:19:32 -04:00
|
|
|
getFormGroup(dir: NgModelGroup): FormGroup;
|
2016-07-12 18:02:25 -04:00
|
|
|
onReset(): void;
|
2016-10-11 18:49:36 -04:00
|
|
|
onSubmit($event: Event): boolean;
|
2016-06-22 17:56:10 -04:00
|
|
|
removeControl(dir: NgModel): void;
|
|
|
|
removeFormGroup(dir: NgModelGroup): void;
|
2016-08-12 02:27:33 -04:00
|
|
|
resetForm(value?: any): void;
|
2016-08-05 16:35:17 -04:00
|
|
|
setValue(value: {
|
2016-07-08 16:04:25 -04:00
|
|
|
[key: string]: any;
|
|
|
|
}): void;
|
2016-08-05 16:35:17 -04:00
|
|
|
updateModel(dir: NgControl, value: any): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class NgModel extends NgControl implements OnChanges, OnDestroy {
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly asyncValidator: AsyncValidatorFn;
|
|
|
|
readonly control: FormControl;
|
|
|
|
readonly formDirective: any;
|
2016-08-25 17:56:31 -04:00
|
|
|
isDisabled: boolean;
|
2016-06-22 17:56:10 -04:00
|
|
|
model: any;
|
|
|
|
name: string;
|
|
|
|
options: {
|
|
|
|
name?: string;
|
|
|
|
standalone?: boolean;
|
|
|
|
};
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly path: string[];
|
2016-06-22 17:56:10 -04:00
|
|
|
update: EventEmitter<{}>;
|
2017-02-07 22:27:01 -05:00
|
|
|
readonly validator: ValidatorFn;
|
2016-06-23 21:19:32 -04:00
|
|
|
viewModel: any;
|
2017-02-20 19:26:51 -05:00
|
|
|
constructor(parent: ControlContainer, validators: Array<Validator | ValidatorFn>, asyncValidators: Array<AsyncValidator | AsyncValidatorFn>, valueAccessors: ControlValueAccessor[]);
|
2017-01-12 07:02:45 -05:00
|
|
|
compositionEnd(): void;
|
|
|
|
compositionStart(): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
ngOnChanges(changes: SimpleChanges): void;
|
|
|
|
ngOnDestroy(): void;
|
|
|
|
viewToModelUpdate(newValue: any): void;
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {
|
|
|
|
name: string;
|
|
|
|
constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]);
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class NgSelectOption implements OnDestroy {
|
|
|
|
id: string;
|
|
|
|
ngValue: any;
|
|
|
|
value: any;
|
2016-06-23 21:19:32 -04:00
|
|
|
constructor(_element: ElementRef, _renderer: Renderer, _select: SelectControlValueAccessor);
|
2016-06-22 17:56:10 -04:00
|
|
|
ngOnDestroy(): void;
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-08-06 02:53:41 -04:00
|
|
|
export declare class PatternValidator implements Validator, OnChanges {
|
2017-02-23 12:53:29 -05:00
|
|
|
pattern: string | RegExp;
|
2016-08-06 02:53:41 -04:00
|
|
|
ngOnChanges(changes: SimpleChanges): void;
|
2016-09-09 17:09:11 -04:00
|
|
|
registerOnValidatorChange(fn: () => void): void;
|
2017-02-23 12:53:29 -05:00
|
|
|
validate(c: AbstractControl): ValidationErrors | null;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-09-19 13:41:20 -04:00
|
|
|
/** @stable */
|
|
|
|
export declare class RadioControlValueAccessor implements ControlValueAccessor, OnDestroy, OnInit {
|
|
|
|
formControlName: string;
|
|
|
|
name: string;
|
|
|
|
onChange: () => void;
|
|
|
|
onTouched: () => void;
|
|
|
|
value: any;
|
|
|
|
constructor(_renderer: Renderer, _elementRef: ElementRef, _registry: RadioControlRegistry, _injector: Injector);
|
|
|
|
fireUncheck(value: any): void;
|
|
|
|
ngOnDestroy(): void;
|
|
|
|
ngOnInit(): void;
|
|
|
|
registerOnChange(fn: (_: any) => {}): void;
|
|
|
|
registerOnTouched(fn: () => {}): void;
|
|
|
|
setDisabledState(isDisabled: boolean): void;
|
|
|
|
writeValue(value: any): void;
|
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
feat(forms): add modules for forms and deprecatedForms (#9859)
Closes #9732
BREAKING CHANGE:
We have removed the deprecated form directives from the built-in platform directive list, so apps are not required to package forms with their app. This also makes forms friendly to offline compilation.
Instead, we have exposed three modules:
OLD API:
- `DeprecatedFormsModule`
NEW API:
- `FormsModule`
- `ReactiveFormsModule`
If you provide one of these modules, the default forms directives and providers from that module will be available to you app-wide. Note: You can provide both the `FormsModule` and the `ReactiveFormsModule` together if you like, but they are fully-functional separately.
**Before:**
```ts
import {disableDeprecatedForms, provideForms} from @angular/forms;
bootstrap(App, [
disableDeprecatedForms(),
provideForms()
]);
```
**After:**
```ts
import {DeprecatedFormsModule} from @angular/common;
bootstrap(App, {modules: [DeprecatedFormsModule] });
```
-OR-
```ts
import {FormsModule} from @angular/forms;
bootstrap(App, {modules: [FormsModule] });
```
-OR-
```ts
import {ReactiveFormsModule} from @angular/forms;
bootstrap(App, {modules: [ReactiveFormsModule] });
```
You can also choose not to provide any forms module and run your app without forms.
Or you can choose not to provide any forms module *and* provide form directives at will. This will allow you to use the deprecatedForms API for some components and not others.
```
import {FORM_DIRECTIVES, FORM_PROVIDERS} from @angular/forms;
@Component({
selector: some-comp,
directives: [FORM_DIRECTIVES],
providers: [FORM_PROVIDERS]
})
class SomeComp
```
2016-07-07 14:32:51 -04:00
|
|
|
export declare class ReactiveFormsModule {
|
|
|
|
}
|
2016-06-22 17:56:10 -04:00
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-08-06 02:53:41 -04:00
|
|
|
export declare class RequiredValidator implements Validator {
|
2017-02-23 12:53:29 -05:00
|
|
|
required: boolean | string;
|
2016-09-09 17:09:11 -04:00
|
|
|
registerOnValidatorChange(fn: () => void): void;
|
2017-02-23 12:53:29 -05:00
|
|
|
validate(c: AbstractControl): ValidationErrors | null;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class SelectControlValueAccessor implements ControlValueAccessor {
|
2016-12-09 16:10:40 -05:00
|
|
|
compareWith: (o1: any, o2: any) => boolean;
|
2016-06-22 17:56:10 -04:00
|
|
|
onChange: (_: any) => void;
|
|
|
|
onTouched: () => void;
|
2016-06-23 21:19:32 -04:00
|
|
|
value: any;
|
2016-06-22 17:56:10 -04:00
|
|
|
constructor(_renderer: Renderer, _elementRef: ElementRef);
|
|
|
|
registerOnChange(fn: (value: any) => any): void;
|
|
|
|
registerOnTouched(fn: () => any): void;
|
2016-08-24 19:58:43 -04:00
|
|
|
setDisabledState(isDisabled: boolean): void;
|
2016-06-23 21:19:32 -04:00
|
|
|
writeValue(value: any): void;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-30 21:04:00 -04:00
|
|
|
export declare class SelectMultipleControlValueAccessor implements ControlValueAccessor {
|
2016-12-09 16:10:40 -05:00
|
|
|
compareWith: (o1: any, o2: any) => boolean;
|
2016-06-30 21:04:00 -04:00
|
|
|
onChange: (_: any) => void;
|
|
|
|
onTouched: () => void;
|
|
|
|
value: any;
|
2016-08-24 19:58:43 -04:00
|
|
|
constructor(_renderer: Renderer, _elementRef: ElementRef);
|
2016-06-30 21:04:00 -04:00
|
|
|
registerOnChange(fn: (value: any) => any): void;
|
|
|
|
registerOnTouched(fn: () => any): void;
|
2016-08-24 19:58:43 -04:00
|
|
|
setDisabledState(isDisabled: boolean): void;
|
2016-06-30 21:04:00 -04:00
|
|
|
writeValue(value: any): void;
|
|
|
|
}
|
|
|
|
|
2017-02-23 12:53:29 -05:00
|
|
|
/** @experimental */
|
|
|
|
export declare type ValidationErrors = {
|
|
|
|
[key: string]: any;
|
|
|
|
};
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export interface Validator {
|
2016-09-09 17:09:11 -04:00
|
|
|
registerOnValidatorChange?(fn: () => void): void;
|
2017-02-23 12:53:29 -05:00
|
|
|
validate(c: AbstractControl): ValidationErrors | null;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-24 21:24:11 -04:00
|
|
|
export interface ValidatorFn {
|
2017-02-23 12:53:29 -05:00
|
|
|
(c: AbstractControl): ValidationErrors | null;
|
2016-06-24 21:24:11 -04:00
|
|
|
}
|
|
|
|
|
2016-08-17 10:44:39 -04:00
|
|
|
/** @stable */
|
2016-06-22 17:56:10 -04:00
|
|
|
export declare class Validators {
|
2016-06-23 21:19:32 -04:00
|
|
|
static compose(validators: ValidatorFn[]): ValidatorFn;
|
|
|
|
static composeAsync(validators: AsyncValidatorFn[]): AsyncValidatorFn;
|
2017-02-23 12:53:29 -05:00
|
|
|
static email(control: AbstractControl): ValidationErrors | null;
|
2016-06-23 21:19:32 -04:00
|
|
|
static maxLength(maxLength: number): ValidatorFn;
|
|
|
|
static minLength(minLength: number): ValidatorFn;
|
2017-02-23 12:53:29 -05:00
|
|
|
static nullValidator(c: AbstractControl): ValidationErrors | null;
|
2016-10-19 12:37:54 -04:00
|
|
|
static pattern(pattern: string | RegExp): ValidatorFn;
|
2017-02-23 12:53:29 -05:00
|
|
|
static required(control: AbstractControl): ValidationErrors | null;
|
|
|
|
static requiredTrue(control: AbstractControl): ValidationErrors | null;
|
2016-06-22 17:56:10 -04:00
|
|
|
}
|
2016-11-30 16:52:08 -05:00
|
|
|
|
|
|
|
/** @stable */
|
|
|
|
export declare const VERSION: Version;
|