(0, minValidator);
* expect(ctrl.hasValidator(minValidator)).toEqual(true)
* expect(ctrl.hasValidator(Validators.min(3))).toEqual(false)
* ```
*
* @param validator The validator to check for presence. Compared by function reference.
* @returns Whether the provided validator was found on this control.
*/
hasValidator(validator: ValidatorFn): boolean;
/**
* Check whether an asynchronous validator function is present on this control. The provided
* validator must be a reference to the exact same function that was provided.
*
* @param validator The asynchronous validator to check for presence. Compared by function
* reference.
* @returns Whether the provided asynchronous validator was found on this control.
*/
hasAsyncValidator(validator: AsyncValidatorFn): boolean;
/**
* Empties out the synchronous validator list.
*
* When you add or remove a validator at run time, you must call
* `updateValueAndValidity()` for the new validation to take effect.
*
*/
clearValidators(): void;
/**
* Empties out the async validator list.
*
* When you add or remove a validator at run time, you must call
* `updateValueAndValidity()` for the new validation to take effect.
*
*/
clearAsyncValidators(): void;
/**
* Marks the control as `touched`. A control is touched by focus and
* blur events that do not change the value.
*
* @see {@link markAsUntouched()}
* @see {@link markAsDirty()}
* @see {@link markAsPristine()}
*
* @param opts Configuration options that determine how the control propagates changes
* and emits events after marking is applied.
* * `onlySelf`: When true, mark only this control. When false or not supplied,
* marks all direct ancestors. Default is false.
* * `emitEvent`: When true or not supplied (the default), the `events`
* observable emits a `TouchedChangeEvent` with the `touched` property being `true`.
* When false, no events are emitted.
*/
markAsTouched(opts?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
/**
* Marks the control and all its descendant controls as `touched`.
* @see {@link markAsTouched()}
*
* @param opts Configuration options that determine how the control propagates changes
* and emits events after marking is applied.
* * `emitEvent`: When true or not supplied (the default), the `events`
* observable emits a `TouchedChangeEvent` with the `touched` property being `true`.
* When false, no events are emitted.
*/
markAllAsTouched(opts?: {
emitEvent?: boolean;
}): void;
/**
* Marks the control as `untouched`.
*
* If the control has any children, also marks all children as `untouched`
* and recalculates the `touched` status of all parent controls.
*
* @see {@link markAsTouched()}
* @see {@link markAsDirty()}
* @see {@link markAsPristine()}
*
* @param opts Configuration options that determine how the control propagates changes
* and emits events after the marking is applied.
* * `onlySelf`: When true, mark only this control. When false or not supplied,
* marks all direct ancestors. Default is false.
* * `emitEvent`: When true or not supplied (the default), the `events`
* observable emits a `TouchedChangeEvent` with the `touched` property being `false`.
* When false, no events are emitted.
*/
markAsUntouched(opts?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
/**
* Marks the control as `dirty`. A control becomes dirty when
* the control's value is changed through the UI; compare `markAsTouched`.
*
* @see {@link markAsTouched()}
* @see {@link markAsUntouched()}
* @see {@link markAsPristine()}
*
* @param opts Configuration options that determine how the control propagates changes
* and emits events after marking is applied.
* * `onlySelf`: When true, mark only this control. When false or not supplied,
* marks all direct ancestors. Default is false.
* * `emitEvent`: When true or not supplied (the default), the `events`
* observable emits a `PristineChangeEvent` with the `pristine` property being `false`.
* When false, no events are emitted.
*/
markAsDirty(opts?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
/**
* Marks the control as `pristine`.
*
* If the control has any children, marks all children as `pristine`,
* and recalculates the `pristine` status of all parent
* controls.
*
* @see {@link markAsTouched()}
* @see {@link markAsUntouched()}
* @see {@link markAsDirty()}
*
* @param opts Configuration options that determine how the control emits events after
* marking is applied.
* * `onlySelf`: When true, mark only this control. When false or not supplied,
* marks all direct ancestors. Default is false.
* * `emitEvent`: When true or not supplied (the default), the `events`
* observable emits a `PristineChangeEvent` with the `pristine` property being `true`.
* When false, no events are emitted.
*/
markAsPristine(opts?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
/**
* Marks the control as `pending`.
*
* A control is pending while the control performs async validation.
*
* @see {@link AbstractControl.status}
*
* @param opts Configuration options that determine how the control propagates changes and
* emits events after marking is applied.
* * `onlySelf`: When true, mark only this control. When false or not supplied,
* marks all direct ancestors. Default is false.
* * `emitEvent`: When true or not supplied (the default), the `statusChanges`
* observable emits an event with the latest status the control is marked pending
* and the `events` observable emits a `StatusChangeEvent` with the `status` property being
* `PENDING` When false, no events are emitted.
*
*/
markAsPending(opts?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
/**
* Disables the control. This means the control is exempt from validation checks and
* excluded from the aggregate value of any parent. Its status is `DISABLED`.
*
* If the control has children, all children are also disabled.
*
* @see {@link AbstractControl.status}
*
* @param opts Configuration options that determine how the control propagates
* changes and emits events after the control is disabled.
* * `onlySelf`: When true, mark only this control. When false or not supplied,
* marks all direct ancestors. Default is false.
* * `emitEvent`: When true or not supplied (the default), the `statusChanges`,
* `valueChanges` and `events`
* observables emit events with the latest status and value when the control is disabled.
* When false, no events are emitted.
*/
disable(opts?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
/**
* Enables the control. This means the control is included in validation checks and
* the aggregate value of its parent. Its status recalculates based on its value and
* its validators.
*
* By default, if the control has children, all children are enabled.
*
* @see {@link AbstractControl.status}
*
* @param opts Configure options that control how the control propagates changes and
* emits events when marked as untouched
* * `onlySelf`: When true, mark only this control. When false or not supplied,
* marks all direct ancestors. Default is false.
* * `emitEvent`: When true or not supplied (the default), the `statusChanges`,
* `valueChanges` and `events`
* observables emit events with the latest status and value when the control is enabled.
* When false, no events are emitted.
*/
enable(opts?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
private _updateAncestors;
/**
* Sets the parent of the control
*
* @param parent The new parent.
*/
setParent(parent: FormGroup | FormArray | null): void;
/**
* Sets the value of the control. Abstract method (implemented in sub-classes).
*/
abstract setValue(value: TRawValue, options?: Object): void;
/**
* Patches the value of the control. Abstract method (implemented in sub-classes).
*/
abstract patchValue(value: TValue, options?: Object): void;
/**
* Resets the control. Abstract method (implemented in sub-classes).
*/
abstract reset(value?: TValue, options?: Object): void;
/**
* The raw value of this control. For most control implementations, the raw value will include
* disabled children.
*/
getRawValue(): any;
/**
* Recalculates the value and validation status of the control.
*
* By default, it also updates the value and validity of its ancestors.
*
* @param opts Configuration options determine how the control propagates changes and emits events
* after updates and validity checks are applied.
* * `onlySelf`: When true, only update this control. When false or not supplied,
* update all direct ancestors. Default is false.
* * `emitEvent`: When true or not supplied (the default), the `statusChanges`,
* `valueChanges` and `events`
* observables emit events with the latest status and value when the control is updated.
* When false, no events are emitted.
*/
updateValueAndValidity(opts?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
private _setInitialStatus;
private _runValidator;
private _runAsyncValidator;
private _cancelExistingSubscription;
/**
* Sets errors on a form control when running validations manually, rather than automatically.
*
* Calling `setErrors` also updates the validity of the parent control.
*
* @param opts Configuration options that determine how the control propagates
* changes and emits events after the control errors are set.
* * `emitEvent`: When true or not supplied (the default), the `statusChanges`
* observable emits an event after the errors are set.
*
* @usageNotes
*
* ### Manually set the errors for a control
*
* ```ts
* const login = new FormControl('someLogin');
* login.setErrors({
* notUnique: true
* });
*
* expect(login.valid).toEqual(false);
* expect(login.errors).toEqual({ notUnique: true });
*
* login.setValue('someOtherLogin');
*
* expect(login.valid).toEqual(true);
* ```
*/
setErrors(errors: ValidationErrors | null, opts?: {
emitEvent?: boolean;
}): void;
/**
* Retrieves a child control given the control's name or path.
*
* This signature for get supports strings and `const` arrays (`.get(['foo', 'bar'] as const)`).
*/
get(path: P): AbstractControl<ɵGetProperty> | null;
/**
* Retrieves a child control given the control's name or path.
*
* This signature for `get` supports non-const (mutable) arrays. Inferred type
* information will not be as robust, so prefer to pass a `readonly` array if possible.
*/
get>(path: P): AbstractControl<ɵGetProperty> | null;
/**
* @description
* Reports error data for the control with the given path.
*
* @param errorCode The code of the error to check
* @param path A list of control names that designates how to move from the current control
* to the control that should be queried for errors.
*
* @usageNotes
* For example, for the following `FormGroup`:
*
* ```ts
* form = new FormGroup({
* address: new FormGroup({ street: new FormControl() })
* });
* ```
*
* The path to the 'street' control from the root form would be 'address' -> 'street'.
*
* It can be provided to this method in one of two formats:
*
* 1. An array of string control names, e.g. `['address', 'street']`
* 1. A period-delimited list of control names in one string, e.g. `'address.street'`
*
* @returns error data for that particular error. If the control or error is not present,
* null is returned.
*/
getError(errorCode: string, path?: Array | string): any;
/**
* @description
* Reports whether the control with the given path has the error specified.
*
* @param errorCode The code of the error to check
* @param path A list of control names that designates how to move from the current control
* to the control that should be queried for errors.
*
* @usageNotes
* For example, for the following `FormGroup`:
*
* ```ts
* form = new FormGroup({
* address: new FormGroup({ street: new FormControl() })
* });
* ```
*
* The path to the 'street' control from the root form would be 'address' -> 'street'.
*
* It can be provided to this method in one of two formats:
*
* 1. An array of string control names, e.g. `['address', 'street']`
* 1. A period-delimited list of control names in one string, e.g. `'address.street'`
*
* If no path is given, this method checks for the error on the current control.
*
* @returns whether the given error is present in the control at the given path.
*
* If the control is not present, false is returned.
*/
hasError(errorCode: string, path?: Array | string): boolean;
/**
* Retrieves the top-level ancestor of this control.
*/
get root(): AbstractControl;
private _calculateStatus;
/**
* Internal implementation of the `setValidators` method. Needs to be separated out into a
* different method, because it is called in the constructor and it can break cases where
* a control is extended.
*/
private _assignValidators;
/**
* Internal implementation of the `setAsyncValidators` method. Needs to be separated out into a
* different method, because it is called in the constructor and it can break cases where
* a control is extended.
*/
private _assignAsyncValidators;
}
/**
* @description
* Base class for control directives.
*
* This class is only used internally in the `ReactiveFormsModule` and the `FormsModule`.
*
* @publicApi
*/
declare abstract class AbstractControlDirective {
/**
* @description
* A reference to the underlying control.
*
* @returns the control that backs this directive. Most properties fall through to that instance.
*/
abstract get control(): AbstractControl | null;
/**
* @description
* Reports the value of the control if it is present, otherwise null.
*/
get value(): any;
/**
* @description
* Reports whether the control is valid. A control is considered valid if no
* validation errors exist with the current value.
* If the control is not present, null is returned.
*/
get valid(): boolean | null;
/**
* @description
* Reports whether the control is invalid, meaning that an error exists in the input value.
* If the control is not present, null is returned.
*/
get invalid(): boolean | null;
/**
* @description
* Reports whether a control is pending, meaning that async validation is occurring and
* errors are not yet available for the input value. If the control is not present, null is
* returned.
*/
get pending(): boolean | null;
/**
* @description
* Reports whether the control is disabled, meaning that the control is disabled
* in the UI and is exempt from validation checks and excluded from aggregate
* values of ancestor controls. If the control is not present, null is returned.
*/
get disabled(): boolean | null;
/**
* @description
* Reports whether the control is enabled, meaning that the control is included in ancestor
* calculations of validity or value. If the control is not present, null is returned.
*/
get enabled(): boolean | null;
/**
* @description
* Reports the control's validation errors. If the control is not present, null is returned.
*/
get errors(): ValidationErrors | null;
/**
* @description
* Reports whether the control is pristine, meaning that the user has not yet changed
* the value in the UI. If the control is not present, null is returned.
*/
get pristine(): boolean | null;
/**
* @description
* Reports whether the control is dirty, meaning that the user has changed
* the value in the UI. If the control is not present, null is returned.
*/
get dirty(): boolean | null;
/**
* @description
* Reports whether the control is touched, meaning that the user has triggered
* a `blur` event on it. If the control is not present, null is returned.
*/
get touched(): boolean | null;
/**
* @description
* Reports the validation status of the control. Possible values include:
* 'VALID', 'INVALID', 'DISABLED', and 'PENDING'.
* If the control is not present, null is returned.
*/
get status(): string | null;
/**
* @description
* Reports whether the control is untouched, meaning that the user has not yet triggered
* a `blur` event on it. If the control is not present, null is returned.
*/
get untouched(): boolean | null;
/**
* @description
* Returns a multicasting observable that emits a validation status whenever it is
* calculated for the control. If the control is not present, null is returned.
*/
get statusChanges(): Observable | null;
/**
* @description
* Returns a multicasting observable of value changes for the control that emits every time the
* value of the control changes in the UI or programmatically.
* If the control is not present, null is returned.
*/
get valueChanges(): Observable | null;
/**
* @description
* Returns an array that represents the path from the top-level form to this control.
* Each index is the string name of the control on that level.
*/
get path(): string[] | null;
/**
* Contains the result of merging synchronous validators into a single validator function
* (combined using `Validators.compose`).
*/
private _composedValidatorFn;
/**
* Contains the result of merging asynchronous validators into a single validator function
* (combined using `Validators.composeAsync`).
*/
private _composedAsyncValidatorFn;
/**
* @description
* Synchronous validator function composed of all the synchronous validators registered with this
* directive.
*/
get validator(): ValidatorFn | null;
/**
* @description
* Asynchronous validator function composed of all the asynchronous validators registered with
* this directive.
*/
get asyncValidator(): AsyncValidatorFn | null;
private _onDestroyCallbacks;
/**
* @description
* Resets the control with the provided value if the control is present.
*/
reset(value?: any): void;
/**
* @description
* Reports whether the control with the given path has the error specified.
*
* @param errorCode The code of the error to check
* @param path A list of control names that designates how to move from the current control
* to the control that should be queried for errors.
*
* @usageNotes
* For example, for the following `FormGroup`:
*
* ```ts
* form = new FormGroup({
* address: new FormGroup({ street: new FormControl() })
* });
* ```
*
* The path to the 'street' control from the root form would be 'address' -> 'street'.
*
* It can be provided to this method in one of two formats:
*
* 1. An array of string control names, e.g. `['address', 'street']`
* 1. A period-delimited list of control names in one string, e.g. `'address.street'`
*
* If no path is given, this method checks for the error on the current control.
*
* @returns whether the given error is present in the control at the given path.
*
* If the control is not present, false is returned.
*/
hasError(errorCode: string, path?: Array | string): boolean;
/**
* @description
* Reports error data for the control with the given path.
*
* @param errorCode The code of the error to check
* @param path A list of control names that designates how to move from the current control
* to the control that should be queried for errors.
*
* @usageNotes
* For example, for the following `FormGroup`:
*
* ```ts
* form = new FormGroup({
* address: new FormGroup({ street: new FormControl() })
* });
* ```
*
* The path to the 'street' control from the root form would be 'address' -> 'street'.
*
* It can be provided to this method in one of two formats:
*
* 1. An array of string control names, e.g. `['address', 'street']`
* 1. A period-delimited list of control names in one string, e.g. `'address.street'`
*
* @returns error data for that particular error. If the control or error is not present,
* null is returned.
*/
getError(errorCode: string, path?: Array | string): any;
}
/**
* @description
* A base class that all `FormControl`-based directives extend. It binds a `FormControl`
* object to a DOM element.
*
* @publicApi
*/
declare abstract class NgControl extends AbstractControlDirective {
/**
* @description
* The name for the control
*/
name: string | number | null;
/**
* @description
* The value accessor for the control
*/
valueAccessor: ControlValueAccessor | null;
/**
* @description
* The callback method to update the model from the view when requested
*
* @param newValue The new value for the view
*/
abstract viewToModelUpdate(newValue: any): void;
}
/**
* @description
* Class used by Angular to track radio buttons. For internal use only.
*/
declare class RadioControlRegistry {
private _accessors;
/**
* @description
* Adds a control to the internal registry. For internal use only.
*/
add(control: NgControl, accessor: RadioControlValueAccessor): void;
/**
* @description
* Removes a control from the internal registry. For internal use only.
*/
remove(accessor: RadioControlValueAccessor): void;
/**
* @description
* Selects a radio button. For internal use only.
*/
select(accessor: RadioControlValueAccessor): void;
private _isSameGroup;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵprov: i0.ɵɵInjectableDeclaration;
}
/**
* @description
* The `ControlValueAccessor` for writing radio control values and listening to radio control
* changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and
* `NgModel` directives.
*
* @usageNotes
*
* ### Using radio buttons with reactive form directives
*
* The follow example shows how to use radio buttons in a reactive form. When using radio buttons in
* a reactive form, radio buttons in the same group should have the same `formControlName`.
* Providing a `name` attribute is optional.
*
* {@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'}
*
* @ngModule ReactiveFormsModule
* @ngModule FormsModule
* @publicApi
*/
declare class RadioControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor, OnDestroy, OnInit {
private _registry;
private _injector;
private setDisabledStateFired;
/**
* The registered callback function called when a change event occurs on the input element.
* Note: we declare `onChange` here (also used as host listener) as a function with no arguments
* to override the `onChange` function (which expects 1 argument) in the parent
* `BaseControlValueAccessor` class.
* @docs-private
*/
onChange: () => void;
/**
* @description
* Tracks the name of the radio input element.
*/
name: string;
/**
* @description
* Tracks the name of the `FormControl` bound to the directive. The name corresponds
* to a key in the parent `FormGroup` or `FormArray`.
*/
formControlName: string;
/**
* @description
* Tracks the value of the radio input element
*/
value: any;
private callSetDisabledState;
constructor(renderer: Renderer2, elementRef: ElementRef, _registry: RadioControlRegistry, _injector: Injector);
/** @docs-private */
ngOnInit(): void;
/** @docs-private */
ngOnDestroy(): void;
/**
* Sets the "checked" property value on the radio input element.
* @docs-private
*/
writeValue(value: any): void;
/**
* Registers a function called when the control value changes.
* @docs-private
*/
registerOnChange(fn: (_: any) => {}): void;
/** @docs-private */
setDisabledState(isDisabled: boolean): void;
/**
* Sets the "value" on the radio input element and unchecks it.
*
* @param value
*/
fireUncheck(value: any): void;
private _checkName;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
/**
* FormControlState is a boxed form value. It is an object with a `value` key and a `disabled` key.
*
* @publicApi
*/
interface FormControlState {
value: T;
disabled: boolean;
}
/**
* Interface for options provided to a `FormControl`.
*
* This interface extends all options from {@link AbstractControlOptions}, plus some options
* unique to `FormControl`.
*
* @publicApi
*/
interface FormControlOptions extends AbstractControlOptions {
/**
* @description
* Whether to use the initial value used to construct the `FormControl` as its default value
* as well. If this option is false or not provided, the default value of a FormControl is `null`.
* When a FormControl is reset without an explicit value, its value reverts to
* its default value.
*/
nonNullable?: boolean;
/**
* @deprecated Use `nonNullable` instead.
*/
initialValueIsDefault?: boolean;
}
/**
* Various available constructors for `FormControl`.
* Do not use this interface directly. Instead, use `FormControl`:
* ```ts
* const fc = new FormControl('foo');
* ```
* This symbol is prefixed with ɵ to make plain that it is an internal symbol.
*/
interface ɵFormControlCtor {
/**
* Construct a FormControl with no initial value or validators.
*/
new (): FormControl;
/**
* Creates a new `FormControl` instance.
*
* @param value Initializes the control with an initial value,
* or an object that defines the initial value and disabled state.
*
* @param opts A `FormControlOptions` object that contains validation functions and a
* validation trigger. `nonNullable` have to be `true`
*/
new (value: FormControlState | T, opts: FormControlOptions & {
nonNullable: true;
}): FormControl;
/**
* @deprecated Use `nonNullable` instead.
*/
new (value: FormControlState | T, opts: FormControlOptions & {
initialValueIsDefault: true;
}): FormControl;
/**
* @deprecated When passing an `options` argument, the `asyncValidator` argument has no effect.
*/
new (value: FormControlState | T, opts: FormControlOptions, asyncValidator: AsyncValidatorFn | AsyncValidatorFn[]): FormControl;
/**
* Creates a new `FormControl` instance.
*
* @param value Initializes the control with an initial value,
* or an object that defines the initial value and disabled state.
*
* @param validatorOrOpts A synchronous validator function, or an array of
* such functions, or a `FormControlOptions` object that contains validation functions
* and a validation trigger.
*
* @param asyncValidator A single async validator or array of async validator functions
*/
new (value: FormControlState | T, validatorOrOpts?: ValidatorFn | ValidatorFn[] | FormControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): FormControl;
/**
* The presence of an explicit `prototype` property provides backwards-compatibility for apps that
* manually inspect the prototype chain.
*/
prototype: FormControl;
}
/**
* Tracks the value and validation status of an individual form control.
*
* This is one of the four fundamental building blocks of Angular forms, along with
* `FormGroup`, `FormArray` and `FormRecord`. It extends the `AbstractControl` class that
* implements most of the base functionality for accessing the value, validation status,
* user interactions and events.
*
* `FormControl` takes a single generic argument, which describes the type of its value. This
* argument always implicitly includes `null` because the control can be reset. To change this
* behavior, set `nonNullable` or see the usage notes below.
*
* See [usage examples below](#usage-notes).
*
* @see {@link AbstractControl}
* @see [Reactive Forms Guide](guide/forms/reactive-forms)
* @see [Usage Notes](#usage-notes)
*
* @publicApi
*
* @overriddenImplementation ɵFormControlCtor
*
* @usageNotes
*
* ### Initializing Form Controls
*
* Instantiate a `FormControl`, with an initial value.
*
* ```ts
* const control = new FormControl('some value');
* console.log(control.value); // 'some value'
* ```
*
* The following example initializes the control with a form state object. The `value`
* and `disabled` keys are required in this case.
*
* ```ts
* const control = new FormControl({ value: 'n/a', disabled: true });
* console.log(control.value); // 'n/a'
* console.log(control.status); // 'DISABLED'
* ```
*
* The following example initializes the control with a synchronous validator.
*
* ```ts
* const control = new FormControl('', Validators.required);
* console.log(control.value); // ''
* console.log(control.status); // 'INVALID'
* ```
*
* The following example initializes the control using an options object.
*
* ```ts
* const control = new FormControl('', {
* validators: Validators.required,
* asyncValidators: myAsyncValidator
* });
* ```
*
* ### The single type argument
*
* `FormControl` accepts a generic argument, which describes the type of its value.
* In most cases, this argument will be inferred.
*
* If you are initializing the control to `null`, or you otherwise wish to provide a
* wider type, you may specify the argument explicitly:
*
* ```ts
* let fc = new FormControl(null);
* fc.setValue('foo');
* ```
*
* You might notice that `null` is always added to the type of the control.
* This is because the control will become `null` if you call `reset`. You can change
* this behavior by setting `{nonNullable: true}`.
*
* ### Configure the control to update on a blur event
*
* Set the `updateOn` option to `'blur'` to update on the blur `event`.
*
* ```ts
* const control = new FormControl('', { updateOn: 'blur' });
* ```
*
* ### Configure the control to update on a submit event
*
* Set the `updateOn` option to `'submit'` to update on a submit `event`.
*
* ```ts
* const control = new FormControl('', { updateOn: 'submit' });
* ```
*
* ### Reset the control back to a specific value
*
* You reset to a specific form state by passing through a standalone
* value or a form state object that contains both a value and a disabled state
* (these are the only two properties that cannot be calculated).
*
* ```ts
* const control = new FormControl('Nancy');
*
* console.log(control.value); // 'Nancy'
*
* control.reset('Drew');
*
* console.log(control.value); // 'Drew'
* ```
*
* ### Reset the control to its initial value
*
* If you wish to always reset the control to its initial value (instead of null),
* you can pass the `nonNullable` option:
*
* ```ts
* const control = new FormControl('Nancy', {nonNullable: true});
*
* console.log(control.value); // 'Nancy'
*
* control.reset();
*
* console.log(control.value); // 'Nancy'
* ```
*
* ### Reset the control back to an initial value and disabled
*
* ```ts
* const control = new FormControl('Nancy');
*
* console.log(control.value); // 'Nancy'
* console.log(control.status); // 'VALID'
*
* control.reset({ value: 'Drew', disabled: true });
*
* console.log(control.value); // 'Drew'
* console.log(control.status); // 'DISABLED'
* ```
*/
interface FormControl extends AbstractControl {
/**
* The default value of this FormControl, used whenever the control is reset without an explicit
* value. See {@link FormControlOptions#nonNullable} for more information on configuring
* a default value.
*/
readonly defaultValue: TValue;
/**
* Sets a new value for the form control.
*
* @param value The new value for the control.
* @param options Configuration options that determine how the control propagates changes
* and emits events when the value changes.
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
* updateValueAndValidity} method.
*
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
* false.
* * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
* `valueChanges`
* observables emit events with the latest status and value when the control value is updated.
* When false, no events are emitted.
* * `emitModelToViewChange`: When true or not supplied (the default), each change triggers an
* `onChange` event to
* update the view.
* * `emitViewToModelChange`: When true or not supplied (the default), each change triggers an
* `ngModelChange`
* event to update the model.
*
*/
setValue(value: TValue, options?: {
onlySelf?: boolean;
emitEvent?: boolean;
emitModelToViewChange?: boolean;
emitViewToModelChange?: boolean;
}): void;
/**
* Patches the value of a control.
*
* This function is functionally the same as {@link FormControl#setValue setValue} at this level.
* It exists for symmetry with {@link FormGroup#patchValue patchValue} on `FormGroups` and
* `FormArrays`, where it does behave differently.
*
* @see {@link FormControl#setValue} for options
*/
patchValue(value: TValue, options?: {
onlySelf?: boolean;
emitEvent?: boolean;
emitModelToViewChange?: boolean;
emitViewToModelChange?: boolean;
}): void;
/**
* Resets the form control, marking it `pristine` and `untouched`, and resetting
* the value. The new value will be the provided value (if passed), `null`, or the initial value
* if `nonNullable` was set in the constructor via {@link FormControlOptions}.
*
* ```ts
* // By default, the control will reset to null.
* const dog = new FormControl('spot');
* dog.reset(); // dog.value is null
*
* // If this flag is set, the control will instead reset to the initial value.
* const cat = new FormControl('tabby', {nonNullable: true});
* cat.reset(); // cat.value is "tabby"
*
* // A value passed to reset always takes precedence.
* const fish = new FormControl('finn', {nonNullable: true});
* fish.reset('bubble'); // fish.value is "bubble"
* ```
*
* @param formState Resets the control with an initial value,
* or an object that defines the initial value and disabled state.
*
* @param options Configuration options that determine how the control propagates changes
* and emits events after the value changes.
*
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
* false.
* * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
* `valueChanges`
* observables emit events with the latest status and value when the control is reset.
* When false, no events are emitted.
*
*/
reset(formState?: TValue | FormControlState, options?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
/**
* For a simple FormControl, the raw value is equivalent to the value.
*/
getRawValue(): TValue;
/**
* Register a listener for change events.
*
* @param fn The method that is called when the value changes
*/
registerOnChange(fn: Function): void;
/**
* Register a listener for disabled events.
*
* @param fn The method that is called when the disabled status changes.
*/
registerOnDisabledChange(fn: (isDisabled: boolean) => void): void;
}
declare const FormControl: ɵFormControlCtor;
interface UntypedFormControlCtor {
new (): UntypedFormControl;
new (formState?: any, validatorOrOpts?: ValidatorFn | ValidatorFn[] | FormControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null): UntypedFormControl;
/**
* The presence of an explicit `prototype` property provides backwards-compatibility for apps that
* manually inspect the prototype chain.
*/
prototype: FormControl;
}
/**
* UntypedFormControl is a non-strongly-typed version of `FormControl`.
*/
type UntypedFormControl = FormControl;
declare const UntypedFormControl: UntypedFormControlCtor;
/**
* @description
* Asserts that the given control is an instance of `FormControl`
*
* @publicApi
*/
declare const isFormControl: (control: unknown) => control is FormControl;
/**
* @description
* A base class for code shared between the `NgModelGroup` and `FormGroupName` directives.
*
* @publicApi
*/
declare class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
/** @docs-private */
ngOnInit(): void;
/** @docs-private */
ngOnDestroy(): void;
/**
* @description
* The `FormGroup` bound to this directive.
*/
get control(): FormGroup;
/**
* @description
* The path to this group from the top-level directive.
*/
get path(): string[];
/**
* @description
* The top-level directive for this group if present, otherwise null.
*/
get formDirective(): Form | null;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
/**
* @description
* An interface implemented by `FormGroupDirective` and `NgForm` directives.
*
* Only used by the `ReactiveFormsModule` and `FormsModule`.
*
* @publicApi
*/
interface Form {
/**
* @description
* Add a control to this form.
*
* @param dir The control directive to add to the form.
*/
addControl(dir: NgControl): void;
/**
* @description
* Remove a control from this form.
*
* @param dir: The control directive to remove from the form.
*/
removeControl(dir: NgControl): void;
/**
* @description
* The control directive from which to get the `FormControl`.
*
* @param dir: The control directive.
*/
getControl(dir: NgControl): FormControl;
/**
* @description
* Add a group of controls to this form.
*
* @param dir: The control group directive to add.
*/
addFormGroup(dir: AbstractFormGroupDirective): void;
/**
* @description
* Remove a group of controls to this form.
*
* @param dir: The control group directive to remove.
*/
removeFormGroup(dir: AbstractFormGroupDirective): void;
/**
* @description
* The `FormGroup` associated with a particular `AbstractFormGroupDirective`.
*
* @param dir: The form group directive from which to get the `FormGroup`.
*/
getFormGroup(dir: AbstractFormGroupDirective): FormGroup;
/**
* @description
* Update the model for a particular control with a new value.
*
* @param dir: The control directive to update.
* @param value: The new value for the control.
*/
updateModel(dir: NgControl, value: any): void;
}
/**
* @description
* A base class for directives that contain multiple registered instances of `NgControl`.
* Only used by the forms module.
*
* @publicApi
*/
declare abstract class ControlContainer extends AbstractControlDirective {
/**
* @description
* The name for the control
*/
name: string | number | null;
/**
* @description
* The top-level form directive for the control.
*/
get formDirective(): Form | null;
/**
* @description
* The path to this group.
*/
get path(): string[] | null;
}
declare class AbstractControlStatus {
private _cd;
constructor(cd: AbstractControlDirective | null);
protected get isTouched(): boolean;
protected get isUntouched(): boolean;
protected get isPristine(): boolean;
protected get isDirty(): boolean;
protected get isValid(): boolean;
protected get isInvalid(): boolean;
protected get isPending(): boolean;
protected get isSubmitted(): boolean;
}
/**
* @description
* Directive automatically applied to Angular form controls that sets CSS classes
* based on control status.
*
* @usageNotes
*
* ### CSS classes applied
*
* The following classes are applied as the properties become true:
*
* * ng-valid
* * ng-invalid
* * ng-pending
* * ng-pristine
* * ng-dirty
* * ng-untouched
* * ng-touched
*
* @ngModule ReactiveFormsModule
* @ngModule FormsModule
* @publicApi
*/
declare class NgControlStatus extends AbstractControlStatus {
constructor(cd: NgControl);
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
/**
* @description
* Directive automatically applied to Angular form groups that sets CSS classes
* based on control status (valid/invalid/dirty/etc). On groups, this includes the additional
* class ng-submitted.
*
* @see {@link NgControlStatus}
*
* @ngModule ReactiveFormsModule
* @ngModule FormsModule
* @publicApi
*/
declare class NgControlStatusGroup extends AbstractControlStatus {
constructor(cd: ControlContainer);
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
/**
* @description
* Syncs a `FormControl` in an existing `FormGroup` to a form control
* element by name.
*
* @see [Reactive Forms Guide](guide/forms/reactive-forms)
* @see {@link FormControl}
* @see {@link AbstractControl}
*
* @usageNotes
*
* ### Register `FormControl` within a group
*
* The following example shows how to register multiple form controls within a form group
* and set their value.
*
* {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
*
* To see `formControlName` examples with different form control types, see:
*
* * Radio buttons: `RadioControlValueAccessor`
* * Selects: `SelectControlValueAccessor`
*
* ### Use with ngModel is deprecated
*
* Support for using the `ngModel` input property and `ngModelChange` event with reactive
* form directives has been deprecated in Angular v6 and is scheduled for removal in
* a future version of Angular.
*
* @ngModule ReactiveFormsModule
* @publicApi
*/
declare class FormControlName extends NgControl implements OnChanges, OnDestroy {
private _ngModelWarningConfig;
private _added;
/**
* @description
* Tracks the `FormControl` instance bound to the directive.
*/
readonly control: FormControl;
/**
* @description
* Tracks the name of the `FormControl` bound to the directive. The name corresponds
* to a key in the parent `FormGroup` or `FormArray`.
* Accepts a name as a string or a number.
* The name in the form of a string is useful for individual forms,
* while the numerical form allows for form controls to be bound
* to indices when iterating over controls in a `FormArray`.
*/
name: string | number | null;
/**
* @description
* Triggers a warning in dev mode that this input should not be used with reactive forms.
*/
set isDisabled(isDisabled: boolean);
/** @deprecated as of v6 */
model: any;
/** @deprecated as of v6 */
update: EventEmitter;
constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _ngModelWarningConfig: string | null);
/** @docs-private */
ngOnChanges(changes: SimpleChanges): void;
/** @docs-private */
ngOnDestroy(): void;
/**
* @description
* Sets the new value for the view model and emits an `ngModelChange` event.
*
* @param newValue The new value for the view model.
*/
viewToModelUpdate(newValue: any): void;
/**
* @description
* Returns an array that represents the path from the top-level form to this control.
* Each index is the string name of the control on that level.
*/
get path(): string[];
/**
* @description
* The top-level directive for this group if present, otherwise null.
*/
get formDirective(): any;
private _setUpControl;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
/**
* @description
*
* Binds an existing `FormGroup` or `FormRecord` to a DOM element.
*
* This directive accepts an existing `FormGroup` instance. It will then use this
* `FormGroup` instance to match any child `FormControl`, `FormGroup`/`FormRecord`,
* and `FormArray` instances to child `FormControlName`, `FormGroupName`,
* and `FormArrayName` directives.
*
* @see [Reactive Forms Guide](guide/forms/reactive-forms)
* @see {@link AbstractControl}
*
* @usageNotes
* ### Register Form Group
*
* The following example registers a `FormGroup` with first name and last name controls,
* and listens for the *ngSubmit* event when the button is clicked.
*
* {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
*
* @ngModule ReactiveFormsModule
* @publicApi
*/
declare class FormGroupDirective extends ControlContainer implements Form, OnChanges, OnDestroy {
private callSetDisabledState?;
/**
* @description
* Reports whether the form submission has been triggered.
*/
get submitted(): boolean;
private set submitted(value);
private readonly _submittedReactive;
/**
* Reference to an old form group input value, which is needed to cleanup
* old instance in case it was replaced with a new one.
*/
private _oldForm;
/**
* Callback that should be invoked when controls in FormGroup or FormArray collection change
* (added or removed). This callback triggers corresponding DOM updates.
*/
private readonly _onCollectionChange;
/**
* @description
* Tracks the list of added `FormControlName` instances
*/
directives: FormControlName[];
/**
* @description
* Tracks the `FormGroup` bound to this directive.
*/
form: FormGroup;
/**
* @description
* Emits an event when the form submission has been triggered.
*/
ngSubmit: EventEmitter;
constructor(validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], callSetDisabledState?: SetDisabledStateOption | undefined);
/** @docs-private */
ngOnChanges(changes: SimpleChanges): void;
/** @docs-private */
ngOnDestroy(): void;
/**
* @description
* Returns this directive's instance.
*/
get formDirective(): Form;
/**
* @description
* Returns the `FormGroup` bound to this directive.
*/
get control(): FormGroup;
/**
* @description
* Returns an array representing the path to this group. Because this directive
* always lives at the top level of a form, it always an empty array.
*/
get path(): string[];
/**
* @description
* Method that sets up the control directive in this group, re-calculates its value
* and validity, and adds the instance to the internal list of directives.
*
* @param dir The `FormControlName` directive instance.
*/
addControl(dir: FormControlName): FormControl;
/**
* @description
* Retrieves the `FormControl` instance from the provided `FormControlName` directive
*
* @param dir The `FormControlName` directive instance.
*/
getControl(dir: FormControlName): FormControl;
/**
* @description
* Removes the `FormControlName` instance from the internal list of directives
*
* @param dir The `FormControlName` directive instance.
*/
removeControl(dir: FormControlName): void;
/**
* Adds a new `FormGroupName` directive instance to the form.
*
* @param dir The `FormGroupName` directive instance.
*/
addFormGroup(dir: FormGroupName): void;
/**
* Performs the necessary cleanup when a `FormGroupName` directive instance is removed from the
* view.
*
* @param dir The `FormGroupName` directive instance.
*/
removeFormGroup(dir: FormGroupName): void;
/**
* @description
* Retrieves the `FormGroup` for a provided `FormGroupName` directive instance
*
* @param dir The `FormGroupName` directive instance.
*/
getFormGroup(dir: FormGroupName): FormGroup;
/**
* Performs the necessary setup when a `FormArrayName` directive instance is added to the view.
*
* @param dir The `FormArrayName` directive instance.
*/
addFormArray(dir: FormArrayName): void;
/**
* Performs the necessary cleanup when a `FormArrayName` directive instance is removed from the
* view.
*
* @param dir The `FormArrayName` directive instance.
*/
removeFormArray(dir: FormArrayName): void;
/**
* @description
* Retrieves the `FormArray` for a provided `FormArrayName` directive instance.
*
* @param dir The `FormArrayName` directive instance.
*/
getFormArray(dir: FormArrayName): FormArray;
/**
* Sets the new value for the provided `FormControlName` directive.
*
* @param dir The `FormControlName` directive instance.
* @param value The new value for the directive's control.
*/
updateModel(dir: FormControlName, value: any): void;
/**
* @description
* Method called with the "submit" event is triggered on the form.
* Triggers the `ngSubmit` emitter to emit the "submit" event as its payload.
*
* @param $event The "submit" event object
*/
onSubmit($event: Event): boolean;
/**
* @description
* Method called when the "reset" event is triggered on the form.
*/
onReset(): void;
/**
* @description
* Resets the form to an initial value and resets its submitted status.
*
* @param value The new value for the form.
*/
resetForm(value?: any): void;
private _setUpFormContainer;
private _cleanUpFormContainer;
private _updateRegistrations;
private _updateValidators;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
/**
* @description
*
* Syncs a nested `FormGroup` or `FormRecord` to a DOM element.
*
* This directive can only be used with a parent `FormGroupDirective`.
*
* It accepts the string name of the nested `FormGroup` or `FormRecord` to link, and
* looks for a `FormGroup` or `FormRecord` registered with that name in the parent
* `FormGroup` instance you passed into `FormGroupDirective`.
*
* Use nested form groups to validate a sub-group of a
* form separately from the rest or to group the values of certain
* controls into their own nested object.
*
* @see [Reactive Forms Guide](guide/forms/reactive-forms)
*
* @usageNotes
*
* ### Access the group by name
*
* The following example uses the `AbstractControl.get` method to access the
* associated `FormGroup`
*
* ```ts
* this.form.get('name');
* ```
*
* ### Access individual controls in the group
*
* The following example uses the `AbstractControl.get` method to access
* individual controls within the group using dot syntax.
*
* ```ts
* this.form.get('name.first');
* ```
*
* ### Register a nested `FormGroup`.
*
* The following example registers a nested *name* `FormGroup` within an existing `FormGroup`,
* and provides methods to retrieve the nested `FormGroup` and individual controls.
*
* {@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
*
* @ngModule ReactiveFormsModule
* @publicApi
*/
declare class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy {
/**
* @description
* Tracks the name of the `FormGroup` bound to the directive. The name corresponds
* to a key in the parent `FormGroup` or `FormArray`.
* Accepts a name as a string or a number.
* The name in the form of a string is useful for individual forms,
* while the numerical form allows for form groups to be bound
* to indices when iterating over groups in a `FormArray`.
*/
name: string | number | null;
constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
/**
* @description
*
* Syncs a nested `FormArray` to a DOM element.
*
* This directive is designed to be used with a parent `FormGroupDirective` (selector:
* `[formGroup]`).
*
* It accepts the string name of the nested `FormArray` you want to link, and
* will look for a `FormArray` registered with that name in the parent
* `FormGroup` instance you passed into `FormGroupDirective`.
*
* @see [Reactive Forms Guide](guide/forms/reactive-forms)
* @see {@link AbstractControl}
*
* @usageNotes
*
* ### Example
*
* {@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
*
* @ngModule ReactiveFormsModule
* @publicApi
*/
declare class FormArrayName extends ControlContainer implements OnInit, OnDestroy {
/**
* @description
* Tracks the name of the `FormArray` bound to the directive. The name corresponds
* to a key in the parent `FormGroup` or `FormArray`.
* Accepts a name as a string or a number.
* The name in the form of a string is useful for individual forms,
* while the numerical form allows for form arrays to be bound
* to indices when iterating over arrays in a `FormArray`.
*/
name: string | number | null;
constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[]);
/**
* A lifecycle method called when the directive's inputs are initialized. For internal use only.
* @throws If the directive does not have a valid parent.
* @docs-private
*/
ngOnInit(): void;
/**
* A lifecycle method called before the directive's instance is destroyed. For internal use only.
* @docs-private
*/
ngOnDestroy(): void;
/**
* @description
* The `FormArray` bound to this directive.
*/
get control(): FormArray;
/**
* @description
* The top-level directive for this group if present, otherwise null.
*/
get formDirective(): FormGroupDirective | null;
/**
* @description
* Returns an array that represents the path from the top-level form to this control.
* Each index is the string name of the control on that level.
*/
get path(): string[];
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
/**
* The type for CALL_SET_DISABLED_STATE. If `always`, then ControlValueAccessor will always call
* `setDisabledState` when attached, which is the most correct behavior. Otherwise, it will only be
* called when disabled, which is the legacy behavior for compatibility.
*
* @publicApi
* @see {@link FormsModule#withconfig}
*/
type SetDisabledStateOption = 'whenDisabledForLegacyCode' | 'always';
/**
* @description
* Creates a `FormControl` instance from a [domain
* model](https://en.wikipedia.org/wiki/Domain_model) and binds it to a form control element.
*
* The `FormControl` instance tracks the value, user interaction, and
* validation status of the control and keeps the view synced with the model. If used
* within a parent form, the directive also registers itself with the form as a child
* control.
*
* This directive is used by itself or as part of a larger form. Use the
* `ngModel` selector to activate it.
*
* It accepts a domain model as an optional `Input`. If you have a one-way binding
* to `ngModel` with `[]` syntax, changing the domain model's value in the component
* class sets the value in the view. If you have a two-way binding with `[()]` syntax
* (also known as 'banana-in-a-box syntax'), the value in the UI always syncs back to
* the domain model in your class.
*
* To inspect the properties of the associated `FormControl` (like the validity state),
* export the directive into a local template variable using `ngModel` as the key (ex:
* `#myVar="ngModel"`). You can then access the control using the directive's `control` property.
* However, the most commonly used properties (like `valid` and `dirty`) also exist on the control
* for direct access. See a full list of properties directly available in
* `AbstractControlDirective`.
*
* @see {@link RadioControlValueAccessor}
* @see {@link SelectControlValueAccessor}
*
* @usageNotes
*
* ### Using ngModel on a standalone control
*
* The following examples show a simple standalone control using `ngModel`:
*
* {@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'}
*
* When using the `ngModel` within `
*
* ```
*
* ### Setting the ngModel `name` attribute through options
*
* The following example shows you an alternate way to set the name attribute. Here,
* an attribute identified as name is used within a custom form control component. To still be able
* to specify the NgModel's name, you must specify it using the `ngModelOptions` input instead.
*
* ```html
*
*
* ```
*
* @ngModule FormsModule
* @publicApi
*/
declare class NgModel extends NgControl implements OnChanges, OnDestroy {
private _changeDetectorRef?;
private callSetDisabledState?;
readonly control: FormControl;
/** @docs-private */
static ngAcceptInputType_isDisabled: boolean | string;
/**
* Internal reference to the view model value.
* @docs-private
*/
viewModel: any;
/**
* @description
* Tracks the name bound to the directive. If a parent form exists, it
* uses this name as a key to retrieve this control's value.
*/
name: string;
/**
* @description
* Tracks whether the control is disabled.
*/
isDisabled: boolean;
/**
* @description
* Tracks the value bound to this directive.
*/
model: any;
/**
* @description
* Tracks the configuration options for this `ngModel` instance.
*
* **name**: An alternative to setting the name attribute on the form control element. See
* the [example](api/forms/NgModel#using-ngmodel-on-a-standalone-control) for using `NgModel`
* as a standalone control.
*
* **standalone**: When set to true, the `ngModel` will not register itself with its parent form,
* and acts as if it's not in the form. Defaults to false. If no parent form exists, this option
* has no effect.
*
* **updateOn**: Defines the event upon which the form control value and validity update.
* Defaults to 'change'. Possible values: `'change'` | `'blur'` | `'submit'`.
*
*/
options: {
name?: string;
standalone?: boolean;
updateOn?: FormHooks;
};
/**
* @description
* Event emitter for producing the `ngModelChange` event after
* the view model updates.
*/
update: EventEmitter;
constructor(parent: ControlContainer, validators: (Validator | ValidatorFn)[], asyncValidators: (AsyncValidator | AsyncValidatorFn)[], valueAccessors: ControlValueAccessor[], _changeDetectorRef?: (ChangeDetectorRef | null) | undefined, callSetDisabledState?: SetDisabledStateOption | undefined);
/** @docs-private */
ngOnChanges(changes: SimpleChanges): void;
/** @docs-private */
ngOnDestroy(): void;
/**
* @description
* Returns an array that represents the path from the top-level form to this control.
* Each index is the string name of the control on that level.
*/
get path(): string[];
/**
* @description
* The top-level directive for this control if present, otherwise null.
*/
get formDirective(): any;
/**
* @description
* Sets the new value for the view model and emits an `ngModelChange` event.
*
* @param newValue The new value emitted by `ngModelChange`.
*/
viewToModelUpdate(newValue: any): void;
private _setUpControl;
private _setUpdateStrategy;
private _isStandalone;
private _setUpStandalone;
private _checkForErrors;
private _checkName;
private _updateValue;
private _updateDisabled;
private _getPath;
static ɵfac: i0.ɵɵFactoryDeclaration;
static ɵdir: i0.ɵɵDirectiveDeclaration;
}
/**
* @description
* Creates and binds a `FormGroup` instance to a DOM element.
*
* This directive can only be used as a child of `NgForm` (within `