UNPKG

@rxap/forms

Version:

This package provides a set of tools and directives to simplify working with Angular forms, including reactive forms, custom validators, and form directives for handling loading, submitting, and error states. It offers decorators for defining forms and co

2,133 lines (1,167 loc) 51.4 kB
[**@rxap/forms v19.1.0**](../README.md) *** [@rxap/forms](../globals.md) / RxapFormControl # Class: RxapFormControl\<T, E, Parent\> Defined in: [packages/angular/forms/src/lib/form-control.ts:44](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L44) ## Extends - `UntypedFormControl` ## Type Parameters • **T** = `any` • **E** *extends* `object` = `any` • **Parent** *extends* `object` = `any` ## Constructors ### new RxapFormControl() > **new RxapFormControl**\<`T`, `E`, `Parent`\>(`formState`, `options`): [`RxapFormControl`](RxapFormControl.md)\<`T`, `E`, `Parent`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:126](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L126) #### Parameters ##### formState [`OrBoxedValue`](../type-aliases/OrBoxedValue.md)\<`T`\> ##### options [`_RxapAbstractControlOptions`](../interfaces/RxapAbstractControlOptions.md) & `Record`\<`string`, `any`\> & `object` #### Returns [`RxapFormControl`](RxapFormControl.md)\<`T`, `E`, `Parent`\> #### Overrides `UntypedFormControl.constructor` ## Properties ### controlId > `readonly` **controlId**: `string` Defined in: [packages/angular/forms/src/lib/form-control.ts:95](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L95) *** ### defaultValue > `readonly` **defaultValue**: `any` Defined in: node\_modules/@angular/forms/index.d.ts:3329 The default value of this FormControl, used whenever the control is reset without an explicit value. See FormControlOptions#nonNullable for more information on configuring a default value. #### Inherited from `UntypedFormControl.defaultValue` *** ### dirty$ > `readonly` **dirty$**: `Observable`\<`boolean`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:75](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L75) *** ### disabled$ > `readonly` **disabled$**: `Observable`\<`boolean`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:80](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L80) *** ### enabled$ > `readonly` **enabled$**: `Observable`\<`boolean`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:81](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L81) *** ### errors > `readonly` **errors**: `null` \| `E` Defined in: [packages/angular/forms/src/lib/form-control.ts:59](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L59) An object containing any errors generated by failing validation, or null if there are no errors. #### Overrides `UntypedFormControl.errors` *** ### errors$ > `readonly` **errors$**: `Observable`\<`null` \| `E`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:93](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L93) *** ### events > `readonly` **events**: `Observable`\<`ControlEvent`\<`any`\>\> Defined in: node\_modules/@angular/forms/index.d.ts:2278 A multicasting observable that emits an event every time the state of the control changes. It emits for value, status, pristine or touched changes. **Note**: On value change, the emit happens right after a value of this control is updated. The value of a parent control (for example if this FormControl is a part of a FormGroup) is updated later, so accessing a value of a parent control (using the `value` property) from the callback of this event might result in getting a value that has not been updated yet. Subscribe to the `events` of the parent control instead. For other event types, the events are emitted after the parent control has been updated. #### Inherited from `UntypedFormControl.events` *** ### initialState > `readonly` **initialState**: [`OrBoxedValue`](../type-aliases/OrBoxedValue.md)\<`T`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:66](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L66) *** ### readonly$ > `readonly` **readonly$**: `Observable`\<`boolean`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:100](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L100) *** ### stateChanges > `readonly` **stateChanges**: `Subject`\<`void`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:99](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L99) *** ### status > `readonly` **status**: [`ControlState`](../type-aliases/ControlState.md) Defined in: [packages/angular/forms/src/lib/form-control.ts:64](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L64) The validation status of the control. #### See FormControlStatus These status values are mutually exclusive, so a control cannot be both valid AND invalid or invalid AND disabled. #### Overrides `UntypedFormControl.status` *** ### status$ > `readonly` **status$**: `Observable`\<[`ControlState`](../type-aliases/ControlState.md)\> Defined in: [packages/angular/forms/src/lib/form-control.ts:92](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L92) *** ### statusChanges > `readonly` **statusChanges**: `Observable`\<[`ControlState`](../type-aliases/ControlState.md)\> Defined in: [packages/angular/forms/src/lib/form-control.ts:65](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L65) A multicasting observable that emits an event every time the validation `status` of the control recalculates. #### See - FormControlStatus - [AbstractControl.status](../interfaces/AbstractControl.md#status) #### Overrides `UntypedFormControl.statusChanges` *** ### touch$ > `readonly` **touch$**: `Observable`\<`boolean`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:72](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L72) *** ### value > `readonly` **value**: `T` Defined in: [packages/angular/forms/src/lib/form-control.ts:58](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L58) The current value of the control. * For a `FormControl`, the current value. * For an enabled `FormGroup`, the values of enabled controls as an object with a key-value pair for each member of the group. * For a disabled `FormGroup`, the values of all controls as an object with a key-value pair for each member of the group. * For a `FormArray`, the values of enabled controls as an array. #### Overrides `UntypedFormControl.value` *** ### value$ > `readonly` **value$**: `Observable`\<`T`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:79](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L79) *** ### valueChanges > `readonly` **valueChanges**: `Observable`\<`T`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:62](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L62) A multicasting observable that emits an event every time the value of the control changes, in the UI or programmatically. It also emits an event each time you call enable() or disable() without passing along {emitEvent: false} as a function argument. **Note**: the emit happens right after a value of this control is updated. The value of a parent control (for example if this FormControl is a part of a FormGroup) is updated later, so accessing a value of a parent control (using the `value` property) from the callback of this event might result in getting a value that has not been updated yet. Subscribe to the `valueChanges` event of the parent control instead. #### Overrides `UntypedFormControl.valueChanges` ## Accessors ### asyncValidator #### Get Signature > **get** **asyncValidator**(): `null` \| `AsyncValidatorFn` Defined in: node\_modules/@angular/forms/index.d.ts:2161 Returns the function that is used to determine the validity of this control asynchronously. If multiple validators have been added, this will be a single composed function. See `Validators.compose()` for additional information. ##### Returns `null` \| `AsyncValidatorFn` #### Set Signature > **set** **asyncValidator**(`asyncValidatorFn`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2162 ##### Parameters ###### asyncValidatorFn `null` | `AsyncValidatorFn` ##### Returns `void` #### Inherited from `UntypedFormControl.asyncValidator` *** ### controlPath #### Get Signature > **get** **controlPath**(): `string` Defined in: [packages/angular/forms/src/lib/form-control.ts:102](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L102) ##### Returns `string` *** ### dirty #### Get Signature > **get** **dirty**(): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2249 A control is `dirty` if the user has changed the value in the UI. ##### Returns `boolean` True if the user has changed the value of this control in the UI; compare `pristine`. Programmatic changes to a control's value do not mark it dirty. #### Inherited from `UntypedFormControl.dirty` *** ### disabled #### Get Signature > **get** **disabled**(): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2216 A control is `disabled` when its `status` is `DISABLED`. Disabled controls are exempt from validation checks and are not included in the aggregate value of their ancestor controls. ##### See [AbstractControl.status](../interfaces/AbstractControl.md#status) ##### Returns `boolean` True if the control is disabled, false otherwise. #### Inherited from `UntypedFormControl.disabled` *** ### enabled #### Get Signature > **get** **enabled**(): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2226 A control is `enabled` as long as its `status` is not `DISABLED`. ##### See [AbstractControl.status](../interfaces/AbstractControl.md#status) ##### Returns `boolean` True if the control has any status other than 'DISABLED', false if the status is 'DISABLED'. #### Inherited from `UntypedFormControl.enabled` *** ### fullControlPath #### Get Signature > **get** **fullControlPath**(): `string` Defined in: [packages/angular/forms/src/lib/form-control.ts:116](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L116) ##### Returns `string` *** ### invalid #### Get Signature > **get** **invalid**(): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2195 A control is `invalid` when its `status` is `INVALID`. ##### See [AbstractControl.status](../interfaces/AbstractControl.md#status) ##### Returns `boolean` True if this control has failed one or more of its validation checks, false otherwise. #### Inherited from `UntypedFormControl.invalid` *** ### parent #### Get Signature > **get** **parent**(): `null` \| `FormGroup`\<`any`\> \| `FormArray`\<`any`\> Defined in: node\_modules/@angular/forms/index.d.ts:2166 The parent control. ##### Returns `null` \| `FormGroup`\<`any`\> \| `FormArray`\<`any`\> #### Inherited from `UntypedFormControl.parent` *** ### pending #### Get Signature > **get** **pending**(): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2204 A control is `pending` when its `status` is `PENDING`. ##### See [AbstractControl.status](../interfaces/AbstractControl.md#status) ##### Returns `boolean` True if this control is in the process of conducting a validation check, false otherwise. #### Inherited from `UntypedFormControl.pending` *** ### pristine #### Get Signature > **get** **pristine**(): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2239 A control is `pristine` if the user has not yet changed the value in the UI. ##### Returns `boolean` True if the user has not yet changed the value in the UI; compare `dirty`. Programmatic changes to a control's value do not mark it dirty. #### Set Signature > **set** **pristine**(`value`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2240 ##### Parameters ###### value `boolean` ##### Returns `void` #### Inherited from `UntypedFormControl.pristine` *** ### readonly #### Get Signature > **get** **readonly**(): `boolean` Defined in: [packages/angular/forms/src/lib/form-control.ts:83](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L83) ##### Returns `boolean` #### Set Signature > **set** **readonly**(`value`): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:87](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L87) ##### Parameters ###### value `boolean` ##### Returns `void` *** ### root #### Get Signature > **get** **root**(): `AbstractControl` Defined in: node\_modules/@angular/forms/index.d.ts:2758 Retrieves the top-level ancestor of this control. ##### Returns `AbstractControl` #### Inherited from `UntypedFormControl.root` *** ### rxapFormDefinition #### Get Signature > **get** **rxapFormDefinition**(): `undefined` \| `Partial`\<[`FormDefinition`](../interfaces/FormDefinition.md)\<`Parent`, `any`, `any`\>\> & \{ \[K in string \| number \| symbol\]: Parent\[K\] extends U\[\] ? FormDefinitionArray\<FormType\<U\>\> \| FormDefinitionArray\<RxapFormControl\<U, any, any\>\> \| RxapFormArray\<U, any, any\> \| RxapFormControl\<any\[any\], any, any\> : Parent\[K\] extends Record\<string, any\> ? Partial\<FormDefinition\<any\[any\], any, any\>\> & \{ \[K in string \| number \| symbol\]: any\[any\]\[K\] extends U\[\] ? FormDefinitionArray\<(...)\> \| FormDefinitionArray\<(...)\> \| RxapFormArray\<(...), (...), (...)\> \| RxapFormControl\<(...), (...), (...)\> : (...)\[(...)\] extends Record\<(...), (...)\> ? (...) \| (...) : RxapFormControl\<(...), (...), (...)\> \} & Partial\<FormDefinition\<any\[any\], any, any\>\> \| RxapFormControl\<any\[any\], any, any\> : RxapFormControl\<NonEmpty\<Parent\[K\]\>, any, any\> \} & [`FormDefinition`](../interfaces/FormDefinition.md)\<`Parent`, `any`, `any`\> Defined in: [packages/angular/forms/src/lib/form-control.ts:52](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L52) **`Internal`** ##### Returns `undefined` \| `Partial`\<[`FormDefinition`](../interfaces/FormDefinition.md)\<`Parent`, `any`, `any`\>\> & \{ \[K in string \| number \| symbol\]: Parent\[K\] extends U\[\] ? FormDefinitionArray\<FormType\<U\>\> \| FormDefinitionArray\<RxapFormControl\<U, any, any\>\> \| RxapFormArray\<U, any, any\> \| RxapFormControl\<any\[any\], any, any\> : Parent\[K\] extends Record\<string, any\> ? Partial\<FormDefinition\<any\[any\], any, any\>\> & \{ \[K in string \| number \| symbol\]: any\[any\]\[K\] extends U\[\] ? FormDefinitionArray\<(...)\> \| FormDefinitionArray\<(...)\> \| RxapFormArray\<(...), (...), (...)\> \| RxapFormControl\<(...), (...), (...)\> : (...)\[(...)\] extends Record\<(...), (...)\> ? (...) \| (...) : RxapFormControl\<(...), (...), (...)\> \} & Partial\<FormDefinition\<any\[any\], any, any\>\> \| RxapFormControl\<any\[any\], any, any\> : RxapFormControl\<NonEmpty\<Parent\[K\]\>, any, any\> \} & [`FormDefinition`](../interfaces/FormDefinition.md)\<`Parent`, `any`, `any`\> *** ### touched #### Get Signature > **get** **touched**(): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2256 True if the control is marked as `touched`. A control is marked `touched` once the user has triggered a `blur` event on it. ##### Returns `boolean` #### Set Signature > **set** **touched**(`value`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2257 ##### Parameters ###### value `boolean` ##### Returns `void` #### Inherited from `UntypedFormControl.touched` *** ### untouched #### Get Signature > **get** **untouched**(): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2265 True if the control has not been marked as touched A control is `untouched` if the user has not yet triggered a `blur` event on it. ##### Returns `boolean` #### Inherited from `UntypedFormControl.untouched` *** ### updateOn #### Get Signature > **get** **updateOn**(): `FormHooks` Defined in: node\_modules/@angular/forms/index.d.ts:2305 Reports the update strategy of the `AbstractControl` (meaning the event on which the control updates itself). Possible values: `'change'` | `'blur'` | `'submit'` Default value: `'change'` ##### Returns `FormHooks` #### Inherited from `UntypedFormControl.updateOn` *** ### valid #### Get Signature > **get** **valid**(): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2186 A control is `valid` when its `status` is `VALID`. ##### See [AbstractControl.status](../interfaces/AbstractControl.md#status) ##### Returns `boolean` True if the control has passed all of its validation tests, false otherwise. #### Inherited from `UntypedFormControl.valid` *** ### validator #### Get Signature > **get** **validator**(): `null` \| `ValidatorFn` Defined in: node\_modules/@angular/forms/index.d.ts:2154 Returns the function that is used to determine the validity of this control synchronously. If multiple validators have been added, this will be a single composed function. See `Validators.compose()` for additional information. ##### Returns `null` \| `ValidatorFn` #### Set Signature > **set** **validator**(`validatorFn`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2155 ##### Parameters ###### validatorFn `null` | `ValidatorFn` ##### Returns `void` #### Inherited from `UntypedFormControl.validator` ## Methods ### addAsyncValidators() > **addAsyncValidators**(`validators`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2352 Add an asynchronous validator or validators to this control, without affecting other validators. When you add or remove a validator at run time, you must call `updateValueAndValidity()` for the new validation to take effect. Adding a validator that already exists will have no effect. #### Parameters ##### validators The new asynchronous validator function or functions to add to this control. `AsyncValidatorFn` | `AsyncValidatorFn`[] #### Returns `void` #### Inherited from `UntypedFormControl.addAsyncValidators` *** ### addValidators() > **addValidators**(`validators`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2340 Add a synchronous validator or validators to this control, without affecting other validators. When you add or remove a validator at run time, you must call `updateValueAndValidity()` for the new validation to take effect. Adding a validator that already exists will have no effect. If duplicate validator functions are present in the `validators` array, only the first instance would be added to a form control. #### Parameters ##### validators The new validator function or functions to add to this control. `ValidatorFn` | `ValidatorFn`[] #### Returns `void` #### Inherited from `UntypedFormControl.addValidators` *** ### clearAsyncValidators() > **clearAsyncValidators**(): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2443 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. #### Returns `void` #### Inherited from `UntypedFormControl.clearAsyncValidators` *** ### clearValidators() > **clearValidators**(): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2435 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. #### Returns `void` #### Inherited from `UntypedFormControl.clearValidators` *** ### disable() > **disable**(`opts`?): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2580 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. #### Parameters ##### 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. ###### emitEvent? `boolean` ###### onlySelf? `boolean` #### Returns `void` #### See [AbstractControl.status](../interfaces/AbstractControl.md#status) #### Inherited from `UntypedFormControl.disable` *** ### disabledWhile() > **disabledWhile**(`observable`, `options`?): `Subscription` Defined in: [packages/angular/forms/src/lib/form-control.ts:181](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L181) #### Parameters ##### observable `Observable`\<`boolean`\> ##### options? [`ControlOptions`](../interfaces/ControlOptions.md) #### Returns `Subscription` *** ### enable() > **enable**(`opts`?): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2602 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. #### Parameters ##### 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. ###### emitEvent? `boolean` ###### onlySelf? `boolean` #### Returns `void` #### See [AbstractControl.status](../interfaces/AbstractControl.md#status) #### Inherited from `UntypedFormControl.enable` *** ### enabledWhile() > **enabledWhile**(`observable`, `options`?): `Subscription` Defined in: [packages/angular/forms/src/lib/form-control.ts:188](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L188) #### Parameters ##### observable `Observable`\<`boolean`\> ##### options? [`ControlOptions`](../interfaces/ControlOptions.md) #### Returns `Subscription` *** ### get() #### Call Signature > **get**\<`P`\>(`path`): `null` \| `AbstractControl`\<`ɵGetProperty`\<`any`, `P`\>, `ɵGetProperty`\<`any`, `P`\>\> Defined in: node\_modules/@angular/forms/index.d.ts:2688 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)`). ##### Type Parameters • **P** *extends* `string` \| readonly (`string` \| `number`)[] ##### Parameters ###### path `P` ##### Returns `null` \| `AbstractControl`\<`ɵGetProperty`\<`any`, `P`\>, `ɵGetProperty`\<`any`, `P`\>\> ##### Inherited from `UntypedFormControl.get` #### Call Signature > **get**\<`P`\>(`path`): `null` \| `AbstractControl`\<`ɵGetProperty`\<`any`, `P`\>, `ɵGetProperty`\<`any`, `P`\>\> Defined in: node\_modules/@angular/forms/index.d.ts:2695 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. ##### Type Parameters • **P** *extends* `string` \| (`string` \| `number`)[] ##### Parameters ###### path `P` ##### Returns `null` \| `AbstractControl`\<`ɵGetProperty`\<`any`, `P`\>, `ɵGetProperty`\<`any`, `P`\>\> ##### Inherited from `UntypedFormControl.get` *** ### getError() > **getError**\<`K`\>(`errorCode`): `null` \| `E`\[`K`\] Defined in: [packages/angular/forms/src/lib/form-control.ts:269](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L269) #### Type Parameters • **K** *extends* `string` #### Parameters ##### errorCode `K` The code of the error to check #### Returns `null` \| `E`\[`K`\] error data for that particular error. If the control or error is not present, null is returned. #### Description Reports error data for the control with the given path. #### Usage Notes 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'` #### Overrides `UntypedFormControl.getError` *** ### getRawValue() > **getRawValue**(): `any` Defined in: node\_modules/@angular/forms/index.d.ts:3414 For a simple FormControl, the raw value is equivalent to the value. #### Returns `any` #### Inherited from `UntypedFormControl.getRawValue` *** ### hasAsyncValidator() > **hasAsyncValidator**(`validator`): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2427 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. #### Parameters ##### validator `AsyncValidatorFn` The asynchronous validator to check for presence. Compared by function reference. #### Returns `boolean` Whether the provided asynchronous validator was found on this control. #### Inherited from `UntypedFormControl.hasAsyncValidator` *** ### hasError() > **hasError**\<`K`\>(`errorCode`): `boolean` Defined in: [packages/angular/forms/src/lib/form-control.ts:273](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L273) #### Type Parameters • **K** *extends* `string` #### Parameters ##### errorCode `K` The code of the error to check #### Returns `boolean` whether the given error is present in the control at the given path. If the control is not present, false is returned. #### Description Reports whether the control with the given path has the error specified. #### Usage Notes 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. #### Overrides `UntypedFormControl.hasError` *** ### hasErrorAndDirty() > **hasErrorAndDirty**(`error`): `boolean` Defined in: [packages/angular/forms/src/lib/form-control.ts:289](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L289) #### Parameters ##### error [`ExtractStrings`](../type-aliases/ExtractStrings.md)\<`E`\> #### Returns `boolean` *** ### hasErrorAndTouched() > **hasErrorAndTouched**(`error`): `boolean` Defined in: [packages/angular/forms/src/lib/form-control.ts:285](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L285) #### Parameters ##### error [`ExtractStrings`](../type-aliases/ExtractStrings.md)\<`E`\> #### Returns `boolean` *** ### hasValidator() > **hasValidator**(`validator`): `boolean` Defined in: node\_modules/@angular/forms/index.d.ts:2418 Check whether a synchronous validator function is present on this control. The provided validator must be a reference to the exact same function that was provided. #### Parameters ##### validator `ValidatorFn` The validator to check for presence. Compared by function reference. #### Returns `boolean` Whether the provided validator was found on this control. #### Usage Notes ### Reference to a ValidatorFn ``` // Reference to the RequiredValidator const ctrl = new FormControl<number | null>(0, Validators.required); expect(ctrl.hasValidator(Validators.required)).toEqual(true) // Reference to anonymous function inside MinValidator const minValidator = Validators.min(3); const ctrl = new FormControl<number | null>(0, minValidator); expect(ctrl.hasValidator(minValidator)).toEqual(true) expect(ctrl.hasValidator(Validators.min(3))).toEqual(false) ``` #### Inherited from `UntypedFormControl.hasValidator` *** ### markAllAsDirty() > **markAllAsDirty**(): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:228](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L228) #### Returns `void` *** ### markAllAsTouched() > **markAllAsTouched**(`opts`?): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2474 Marks the control and all its descendant controls as `touched`. #### Parameters ##### 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. ###### emitEvent? `boolean` #### Returns `void` #### See [()](RxapFormControl.md#markastouched) #### Inherited from `UntypedFormControl.markAllAsTouched` *** ### markAsDirty() > **markAsDirty**(`opts`?): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:223](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L223) Marks the control as `dirty`. A control becomes dirty when the control's value is changed through the UI; compare `markAsTouched`. #### Parameters ##### opts? [`OnlySelf`](../type-aliases/OnlySelf.md) 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. #### Returns `void` #### See - [()](RxapFormControl.md#markastouched) - [()](RxapFormControl.md#markasuntouched) - [()](RxapFormControl.md#markaspristine) #### Overrides `UntypedFormControl.markAsDirty` *** ### markAsPending() > **markAsPending**(`opts`?): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2559 Marks the control as `pending`. A control is pending while the control performs async validation. #### Parameters ##### 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. ###### emitEvent? `boolean` ###### onlySelf? `boolean` #### Returns `void` #### See [AbstractControl.status](../interfaces/AbstractControl.md#status) #### Inherited from `UntypedFormControl.markAsPending` *** ### markAsPristine() > **markAsPristine**(`opts`?): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:218](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L218) 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. #### Parameters ##### opts? [`OnlySelf`](../type-aliases/OnlySelf.md) 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. #### Returns `void` #### See - [()](RxapFormControl.md#markastouched) - [()](RxapFormControl.md#markasuntouched) - [()](RxapFormControl.md#markasdirty) #### Overrides `UntypedFormControl.markAsPristine` *** ### markAsTouched() > **markAsTouched**(`opts`?): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:208](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L208) Marks the control as `touched`. A control is touched by focus and blur events that do not change the value. #### Parameters ##### opts? [`OnlySelf`](../type-aliases/OnlySelf.md) 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. #### Returns `void` #### See - [()](RxapFormControl.md#markasuntouched) - [()](RxapFormControl.md#markasdirty) - [()](RxapFormControl.md#markaspristine) #### Overrides `UntypedFormControl.markAsTouched` *** ### markAsUntouched() > **markAsUntouched**(`opts`?): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:213](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L213) 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. #### Parameters ##### opts? [`OnlySelf`](../type-aliases/OnlySelf.md) 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. #### Returns `void` #### See - [()](RxapFormControl.md#markastouched) - [()](RxapFormControl.md#markasdirty) - [()](RxapFormControl.md#markaspristine) #### Overrides `UntypedFormControl.markAsUntouched` *** ### mergeAsyncValidators() > **mergeAsyncValidators**(`validators`): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:199](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L199) #### Parameters ##### validators [`AsyncValidator`](../type-aliases/AsyncValidator.md) #### Returns `void` *** ### mergeValidators() > **mergeValidators**(`validators`): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:195](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L195) #### Parameters ##### validators [`Validator`](../type-aliases/Validator.md) #### Returns `void` *** ### patchValue() #### Call Signature > **patchValue**(`valueOrObservable`, `options`?): `Subscription` Defined in: [packages/angular/forms/src/lib/form-control.ts:163](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L163) Patches the value of a control. This function is functionally the same as FormControl#setValue setValue at this level. It exists for symmetry with FormGroup#patchValue patchValue on `FormGroups` and `FormArrays`, where it does behave differently. ##### Parameters ###### valueOrObservable `Observable`\<`T`\> ###### options? [`ControlOptions`](../interfaces/ControlOptions.md) ##### Returns `Subscription` ##### See FormControl#setValue for options ##### Overrides `UntypedFormControl.patchValue` #### Call Signature > **patchValue**(`valueOrObservable`, `options`?): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:167](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L167) ##### Parameters ###### valueOrObservable `T` ###### options? [`ControlOptions`](../interfaces/ControlOptions.md) ##### Returns `void` ##### Overrides `UntypedFormControl.patchValue` *** ### registerOnChange() > **registerOnChange**(`fn`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:3420 Register a listener for change events. #### Parameters ##### fn `Function` The method that is called when the value changes #### Returns `void` #### Inherited from `UntypedFormControl.registerOnChange` *** ### registerOnDisabledChange() > **registerOnDisabledChange**(`fn`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:3426 Register a listener for disabled events. #### Parameters ##### fn (`isDisabled`) => `void` The method that is called when the disabled status changes. #### Returns `void` #### Inherited from `UntypedFormControl.registerOnDisabledChange` *** ### registerOnSetValue() > **registerOnSetValue**(`setValueFn`): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:301](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L301) #### Parameters ##### setValueFn [`SetValueFn`](../type-aliases/SetValueFn.md)\<`T`\> #### Returns `void` *** ### removeAsyncValidators() > **removeAsyncValidators**(`validators`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2394 Remove an asynchronous validator from this control, without affecting other validators. Validators are compared by function reference; you must pass a reference to the exact same validator function as the one that was originally set. If a provided validator is not found, it is ignored. When you add or remove a validator at run time, you must call `updateValueAndValidity()` for the new validation to take effect. #### Parameters ##### validators The asynchronous validator or validators to remove. `AsyncValidatorFn` | `AsyncValidatorFn`[] #### Returns `void` #### Inherited from `UntypedFormControl.removeAsyncValidators` *** ### removeValidators() > **removeValidators**(`validators`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2382 Remove a synchronous validator from this control, without affecting other validators. Validators are compared by function reference; you must pass a reference to the exact same validator function as the one that was originally set. If a provided validator is not found, it is ignored. #### Parameters ##### validators The validator or validators to remove. `ValidatorFn` | `ValidatorFn`[] #### Returns `void` #### Usage Notes ### Reference to a ValidatorFn ``` // Reference to the RequiredValidator const ctrl = new FormControl<string | null>('', Validators.required); ctrl.removeValidators(Validators.required); // Reference to anonymous function inside MinValidator const minValidator = Validators.min(3); const ctrl = new FormControl<string | null>('', minValidator); expect(ctrl.hasValidator(minValidator)).toEqual(true) expect(ctrl.hasValidator(Validators.min(3))).toEqual(false) ctrl.removeValidators(minValidator); ``` When you add or remove a validator at run time, you must call `updateValueAndValidity()` for the new validation to take effect. #### Inherited from `UntypedFormControl.removeValidators` *** ### reset() > **reset**(`formState`?, `options`?): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:232](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L232) 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 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" ``` #### Parameters ##### formState? [`OrBoxedValue`](../type-aliases/OrBoxedValue.md)\<`T`\> Resets the control with an initial value, or an object that defines the initial value and disabled state. ##### options? [`ControlEventOptions`](../type-aliases/ControlEventOptions.md) 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. #### Returns `void` #### Overrides `UntypedFormControl.reset` *** ### setAsyncValidators() > **setAsyncValidators**(`newValidator`, `updateValueAndValidity`): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:255](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L255) Sets the asynchronous validators that are active on this control. Calling this overwrites any existing asynchronous validators. When you add or remove a validator at run time, you must call `updateValueAndValidity()` for the new validation to take effect. If you want to add a new validator without affecting existing ones, consider using `addAsyncValidators()` method instead. #### Parameters ##### newValidator [`AsyncValidator`](../type-aliases/AsyncValidator.md) ##### updateValueAndValidity `boolean` = `true` #### Returns `void` #### Overrides `UntypedFormControl.setAsyncValidators` *** ### setDisable() > **setDisable**(`disable`, `opts`?): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:297](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L297) #### Parameters ##### disable `boolean` = `true` ##### opts? [`ControlEventOptions`](../type-aliases/ControlEventOptions.md) #### Returns `void` *** ### setEnable() > **setEnable**(`enable`, `opts`?): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:293](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L293) #### Parameters ##### enable `boolean` = `true` ##### opts? [`ControlEventOptions`](../type-aliases/ControlEventOptions.md) #### Returns `void` *** ### setError() > **setError**(`key`, `value`, `opts`): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:281](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L281) #### Parameters ##### key `string` ##### value `any` ##### opts [`EmitEvent`](../type-aliases/EmitEvent.md) = `{}` #### Returns `void` *** ### setErrors() > **setErrors**(`errors`, `opts`): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:277](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L277) Sets errors on a form control when running validations manually, rather than automatically. Calling `setErrors` also updates the validity of the parent control. #### Parameters ##### errors `null` | `Partial`\<`E`\> ##### opts [`EmitEvent`](../type-aliases/EmitEvent.md) = `{}` 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. #### Returns `void` #### Usage Notes ### 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); ``` #### Overrides `UntypedFormControl.setErrors` *** ### setParent() > **setParent**(`parent`): `void` Defined in: node\_modules/@angular/forms/index.d.ts:2612 Sets the parent of the control #### Parameters ##### parent The new parent. `null` | `FormGroup`\<`any`\> | `FormArray`\<`any`\> #### Returns `void` #### Inherited from `UntypedFormControl.setParent` *** ### setValidators() > **setValidators**(`newValidator`, `updateValueAndValidity`): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:245](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L245) Sets the synchronous validators that are active on this control. Calling this overwrites any existing synchronous validators. When you add or remove a validator at run time, you must call `updateValueAndValidity()` for the new validation to take effect. If you want to add a new validator without affecting existing ones, consider using `addValidators()` method instead. #### Parameters ##### newValidator [`Validator`](../type-aliases/Validator.md) ##### updateValueAndValidity `boolean` = `true` #### Returns `void` #### Overrides `UntypedFormControl.setValidators` *** ### setValue() #### Call Signature > **setValue**(`valueOrObservable`, `options`?): `Subscription` Defined in: [packages/angular/forms/src/lib/form-control.ts:141](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L141) Sets a new value for the form control. ##### Parameters ###### valueOrObservable `Observable`\<`T`\> ###### options? [`ControlOptions`](../interfaces/ControlOptions.md) Configuration options that determine how the control propagates changes and emits events when the value changes. The configuration options are passed to the [updateValueAndValidity](../interfaces/AbstractControl.md#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. ##### Returns `Subscription` ##### Overrides `UntypedFormControl.setValue` #### Call Signature > **setValue**(`valueOrObservable`, `options`?): `void` Defined in: [packages/angular/forms/src/lib/form-control.ts:145](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/forms/src/lib/form-control.ts#L145) ##### Parameters ###### valueOrObservable `T` ###### options? [`ControlOptions`](../interface