@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
813 lines (426 loc) • 14.5 kB
Markdown
[@rxap/forms](../wiki/globals) / FormControlNameDirective
# Class: ~~FormControlNameDirective~~
Defined in: [packages/angular/forms/src/lib/directives/form-control-name.directive.ts:42](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/forms/src/lib/directives/form-control-name.directive.ts#L42)
A full exertion of FormControlName from @angular/forms. The only change is the
ability to access the control container outside of the current component
## Deprecated
use the ParentControlContainerDirective
## Extends
- `FormControlName`
## Constructors
### new FormControlNameDirective()
> **new FormControlNameDirective**(`parent`, `validators`, `asyncValidators`, `valueAccessors`): [`FormControlNameDirective`](../wiki/Class.FormControlNameDirective)
Defined in: [packages/angular/forms/src/lib/directives/form-control-name.directive.ts:49](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/forms/src/lib/directives/form-control-name.directive.ts#L49)
#### Parameters
##### parent
`ControlContainer`
##### validators
(`Validator` \| `ValidatorFn`)[]
##### asyncValidators
(`AsyncValidator` \| `AsyncValidatorFn`)[]
##### valueAccessors
`ControlValueAccessor`[]
#### Returns
[`FormControlNameDirective`](../wiki/Class.FormControlNameDirective)
#### Overrides
`FormControlName.constructor`
## Properties
### ~~control~~
> `readonly` **control**: [`RxapFormControl`](../wiki/Class.RxapFormControl)
Defined in: [packages/angular/forms/src/lib/directives/form-control-name.directive.ts:44](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/forms/src/lib/directives/form-control-name.directive.ts#L44)
#### Description
Tracks the `FormControl` instance bound to the directive.
#### Overrides
`FormControlName.control`
***
### ~~model~~
> **model**: `any`
Defined in: node\_modules/@angular/forms/index.d.ts:2423
#### Deprecated
as of v6
#### Inherited from
`FormControlName.model`
***
### ~~name~~
> **name**: `null` \| `string` \| `number`
Defined in: [packages/angular/forms/src/lib/directives/form-control-name.directive.ts:47](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/forms/src/lib/directives/form-control-name.directive.ts#L47)
#### 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`.
#### Overrides
`FormControlName.name`
***
### ~~update~~
> **update**: `EventEmitter`\<`any`\>
Defined in: node\_modules/@angular/forms/index.d.ts:2425
#### Deprecated
as of v6
#### Inherited from
`FormControlName.update`
***
### ~~valueAccessor~~
> **valueAccessor**: `null` \| `ControlValueAccessor`
Defined in: node\_modules/@angular/forms/index.d.ts:3701
#### Description
The value accessor for the control
#### Inherited from
`FormControlName.valueAccessor`
***
### ~~ɵdir~~
> `static` **ɵdir**: `unknown`
Defined in: node\_modules/@angular/forms/index.d.ts:2451
#### Inherited from
`FormControlName.ɵdir`
***
### ~~ɵfac~~
> `static` **ɵfac**: `unknown`
Defined in: node\_modules/@angular/forms/index.d.ts:2450
#### Inherited from
`FormControlName.ɵfac`
## Accessors
### ~~asyncValidator~~
#### Get Signature
> **get** **asyncValidator**(): `null` \| `AsyncValidatorFn`
Defined in: node\_modules/@angular/forms/index.d.ts:822
##### Description
Asynchronous validator function composed of all the asynchronous validators registered with
this directive.
##### Returns
`null` \| `AsyncValidatorFn`
#### Inherited from
`FormControlName.asyncValidator`
***
### ~~dirty~~
#### Get Signature
> **get** **dirty**(): `null` \| `boolean`
Defined in: node\_modules/@angular/forms/index.d.ts:762
##### 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.
##### Returns
`null` \| `boolean`
#### Inherited from
`FormControlName.dirty`
***
### ~~disabled~~
#### Get Signature
> **get** **disabled**(): `null` \| `boolean`
Defined in: node\_modules/@angular/forms/index.d.ts:739
##### 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.
##### Returns
`null` \| `boolean`
#### Inherited from
`FormControlName.disabled`
***
### ~~enabled~~
#### Get Signature
> **get** **enabled**(): `null` \| `boolean`
Defined in: node\_modules/@angular/forms/index.d.ts:745
##### 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.
##### Returns
`null` \| `boolean`
#### Inherited from
`FormControlName.enabled`
***
### ~~errors~~
#### Get Signature
> **get** **errors**(): `null` \| `ValidationErrors`
Defined in: node\_modules/@angular/forms/index.d.ts:750
##### Description
Reports the control's validation errors. If the control is not present, null is returned.
##### Returns
`null` \| `ValidationErrors`
#### Inherited from
`FormControlName.errors`
***
### ~~formDirective~~
#### Get Signature
> **get** **formDirective**(): `any`
Defined in: node\_modules/@angular/forms/index.d.ts:2448
##### Description
The top-level directive for this group if present, otherwise null.
##### Returns
`any`
#### Inherited from
`FormControlName.formDirective`
***
### ~~invalid~~
#### Get Signature
> **get** **invalid**(): `null` \| `boolean`
Defined in: node\_modules/@angular/forms/index.d.ts:725
##### 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.
##### Returns
`null` \| `boolean`
#### Inherited from
`FormControlName.invalid`
***
### ~~isDisabled~~
#### Set Signature
> **set** **isDisabled**(`isDisabled`): `void`
Defined in: node\_modules/@angular/forms/index.d.ts:2421
##### Description
Triggers a warning in dev mode that this input should not be used with reactive forms.
##### Parameters
###### isDisabled
`boolean`
##### Returns
`void`
#### Inherited from
`FormControlName.isDisabled`
***
### ~~path~~
#### Get Signature
> **get** **path**(): `string`[]
Defined in: node\_modules/@angular/forms/index.d.ts:2443
##### 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.
##### Returns
`string`[]
#### Inherited from
`FormControlName.path`
***
### ~~pending~~
#### Get Signature
> **get** **pending**(): `null` \| `boolean`
Defined in: node\_modules/@angular/forms/index.d.ts:732
##### 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.
##### Returns
`null` \| `boolean`
#### Inherited from
`FormControlName.pending`
***
### ~~pristine~~
#### Get Signature
> **get** **pristine**(): `null` \| `boolean`
Defined in: node\_modules/@angular/forms/index.d.ts:756
##### 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.
##### Returns
`null` \| `boolean`
#### Inherited from
`FormControlName.pristine`
***
### ~~status~~
#### Get Signature
> **get** **status**(): `null` \| `string`
Defined in: node\_modules/@angular/forms/index.d.ts:775
##### 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.
##### Returns
`null` \| `string`
#### Inherited from
`FormControlName.status`
***
### ~~statusChanges~~
#### Get Signature
> **get** **statusChanges**(): `null` \| `Observable`\<`any`\>
Defined in: node\_modules/@angular/forms/index.d.ts:787
##### 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.
##### Returns
`null` \| `Observable`\<`any`\>
#### Inherited from
`FormControlName.statusChanges`
***
### ~~touched~~
#### Get Signature
> **get** **touched**(): `null` \| `boolean`
Defined in: node\_modules/@angular/forms/index.d.ts:768
##### 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.
##### Returns
`null` \| `boolean`
#### Inherited from
`FormControlName.touched`
***
### ~~untouched~~
#### Get Signature
> **get** **untouched**(): `null` \| `boolean`
Defined in: node\_modules/@angular/forms/index.d.ts:781
##### 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.
##### Returns
`null` \| `boolean`
#### Inherited from
`FormControlName.untouched`
***
### ~~valid~~
#### Get Signature
> **get** **valid**(): `null` \| `boolean`
Defined in: node\_modules/@angular/forms/index.d.ts:719
##### 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.
##### Returns
`null` \| `boolean`
#### Inherited from
`FormControlName.valid`
***
### ~~validator~~
#### Get Signature
> **get** **validator**(): `null` \| `ValidatorFn`
Defined in: node\_modules/@angular/forms/index.d.ts:816
##### Description
Synchronous validator function composed of all the synchronous validators registered with this
directive.
##### Returns
`null` \| `ValidatorFn`
#### Inherited from
`FormControlName.validator`
***
### ~~value~~
#### Get Signature
> **get** **value**(): `any`
Defined in: node\_modules/@angular/forms/index.d.ts:712
##### Description
Reports the value of the control if it is present, otherwise null.
##### Returns
`any`
#### Inherited from
`FormControlName.value`
***
### ~~valueChanges~~
#### Get Signature
> **get** **valueChanges**(): `null` \| `Observable`\<`any`\>
Defined in: node\_modules/@angular/forms/index.d.ts:794
##### 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.
##### Returns
`null` \| `Observable`\<`any`\>
#### Inherited from
`FormControlName.valueChanges`
## Methods
### ~~getError()~~
> **getError**(`errorCode`, `path`?): `any`
Defined in: node\_modules/@angular/forms/index.d.ts:887
#### Parameters
##### errorCode
`string`
The code of the error to check
##### path?
A list of control names that designates how to move from the current control
to the control that should be queried for errors.
`string` | (`string` \| `number`)[]
#### Returns
`any`
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'`
#### Inherited from
`FormControlName.getError`
***
### ~~hasError()~~
> **hasError**(`errorCode`, `path`?): `boolean`
Defined in: node\_modules/@angular/forms/index.d.ts:859
#### Parameters
##### errorCode
`string`
The code of the error to check
##### path?
A list of control names that designates how to move from the current control
to the control that should be queried for errors.
`string` | (`string` \| `number`)[]
#### 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.
#### Inherited from
`FormControlName.hasError`
***
### ~~ngOnChanges()~~
> **ngOnChanges**(`changes`): `void`
Defined in: node\_modules/@angular/forms/index.d.ts:2428
#### Parameters
##### changes
`SimpleChanges`
#### Returns
`void`
#### Nodoc
#### Inherited from
`FormControlName.ngOnChanges`
***
### ~~ngOnDestroy()~~
> **ngOnDestroy**(): `void`
Defined in: node\_modules/@angular/forms/index.d.ts:2430
#### Returns
`void`
#### Nodoc
#### Inherited from
`FormControlName.ngOnDestroy`
***
### ~~reset()~~
> **reset**(`value`?): `void`
Defined in: node\_modules/@angular/forms/index.d.ts:828
#### Parameters
##### value?
`any`
#### Returns
`void`
#### Description
Resets the control with the provided value if the control is present.
#### Inherited from
`FormControlName.reset`
***
### ~~viewToModelUpdate()~~
> **viewToModelUpdate**(`newValue`): `void`
Defined in: node\_modules/@angular/forms/index.d.ts:2437
#### Parameters
##### newValue
`any`
The new value for the view model.
#### Returns
`void`
#### Description
Sets the new value for the view model and emits an `ngModelChange` event.
#### Inherited from
`FormControlName.viewToModelUpdate`