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

704 lines (371 loc) 12.8 kB
[@rxap/forms](../wiki/globals) / FormGroupNameDirective # Class: ~~FormGroupNameDirective~~ Defined in: [packages/angular/forms/src/lib/directives/form-group-name.directive.ts:35](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/forms/src/lib/directives/form-group-name.directive.ts#L35) A full exertion of FormGroupName from @angular/forms. The only change is the ability to access the control container outside of the current component ## Deprecated use the ParentControlContainerDirective ## Extends - `FormGroupName` ## Constructors ### new FormGroupNameDirective() > **new FormGroupNameDirective**(`parent`, `validators`, `asyncValidators`): [`FormGroupNameDirective`](../wiki/Class.FormGroupNameDirective) Defined in: [packages/angular/forms/src/lib/directives/form-group-name.directive.ts:45](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/forms/src/lib/directives/form-group-name.directive.ts#L45) #### Parameters ##### parent `ControlContainer` ##### validators `any`[] ##### asyncValidators `any`[] #### Returns [`FormGroupNameDirective`](../wiki/Class.FormGroupNameDirective) #### Overrides `FormGroupName.constructor` ## Properties ### ~~name~~ > **name**: `null` \| `string` \| `number` Defined in: [packages/angular/forms/src/lib/directives/form-group-name.directive.ts:38](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/forms/src/lib/directives/form-group-name.directive.ts#L38) #### 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`. #### Overrides `FormGroupName.name` *** ### ~~ɵdir~~ > `static` **ɵdir**: `unknown` Defined in: node\_modules/@angular/forms/index.d.ts:3098 #### Inherited from `FormGroupName.ɵdir` *** ### ~~ɵfac~~ > `static` **ɵfac**: `unknown` Defined in: node\_modules/@angular/forms/index.d.ts:3097 #### Inherited from `FormGroupName.ɵ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 `FormGroupName.asyncValidator` *** ### ~~control~~ #### Get Signature > **get** **control**(): [`RxapFormGroup`](../wiki/Class.RxapFormGroup) Defined in: [packages/angular/forms/src/lib/directives/form-group-name.directive.ts:40](https://gitlab.com/rxap/packages/-/blob/3eebed1be2bbb37bc0d65959f8fecbb850c0b8aa/packages/angular/forms/src/lib/directives/form-group-name.directive.ts#L40) ##### Description The `FormGroup` bound to this directive. ##### Returns [`RxapFormGroup`](../wiki/Class.RxapFormGroup) #### Overrides `FormGroupName.control` *** ### ~~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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.errors` *** ### ~~formDirective~~ #### Get Signature > **get** **formDirective**(): `null` \| `Form` Defined in: node\_modules/@angular/forms/index.d.ts:951 ##### Description The top-level directive for this group if present, otherwise null. ##### Returns `null` \| `Form` #### Inherited from `FormGroupName.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 `FormGroupName.invalid` *** ### ~~path~~ #### Get Signature > **get** **path**(): `string`[] Defined in: node\_modules/@angular/forms/index.d.ts:946 ##### Description The path to this group from the top-level directive. ##### Returns `string`[] #### Inherited from `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.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 `FormGroupName.hasError` *** ### ~~ngOnDestroy()~~ > **ngOnDestroy**(): `void` Defined in: node\_modules/@angular/forms/index.d.ts:936 #### Returns `void` #### Nodoc #### Inherited from `FormGroupName.ngOnDestroy` *** ### ~~ngOnInit()~~ > **ngOnInit**(): `void` Defined in: node\_modules/@angular/forms/index.d.ts:934 #### Returns `void` #### Nodoc #### Inherited from `FormGroupName.ngOnInit` *** ### ~~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 `FormGroupName.reset`