Class FormGroupNameDirective

A full exertion of FormGroupName from @angular/forms. The only change is the ability to access the control container outside of the current component

use the ParentControlContainerDirective

Hierarchy

  • FormGroupName
    • FormGroupNameDirective

Constructors

Properties

name: null | string | number

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.

"ɵdir": unknown
"ɵfac": unknown

Accessors

  • get asyncValidator(): null | AsyncValidatorFn

    Returns null | AsyncValidatorFn

    Asynchronous validator function composed of all the asynchronous validators registered with this directive.

  • get dirty(): null | boolean

    Returns null | boolean

    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 disabled(): null | boolean

    Returns null | boolean

    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 enabled(): null | boolean

    Returns null | boolean

    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 errors(): null | ValidationErrors

    Returns null | ValidationErrors

    Reports the control's validation errors. If the control is not present, null is returned.

  • get formDirective(): null | Form

    Returns null | Form

    The top-level directive for this group if present, otherwise null.

  • get invalid(): null | boolean

    Returns null | boolean

    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 path(): string[]

    Returns string[]

    The path to this group from the top-level directive.

  • get pending(): null | boolean

    Returns null | boolean

    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 pristine(): null | boolean

    Returns null | boolean

    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 status(): null | string

    Returns null | string

    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 statusChanges(): null | Observable<any>

    Returns null | Observable<any>

    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 touched(): null | boolean

    Returns null | boolean

    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 untouched(): null | boolean

    Returns null | boolean

    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 valid(): null | boolean

    Returns null | boolean

    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 validator(): null | ValidatorFn

    Returns null | ValidatorFn

    Synchronous validator function composed of all the synchronous validators registered with this directive.

  • get value(): any

    Returns any

    Reports the value of the control if it is present, otherwise null.

  • get valueChanges(): null | Observable<any>

    Returns null | Observable<any>

    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.

Methods

  • Parameters

    • errorCode: string

      The code of the error to check

    • Optionalpath: string | (string | number)[]

      A list of control names that designates how to move from the current control to the control that should be queried for errors.

    Returns any

    error data for that particular error. If the control or error is not present, null is returned.

    Reports error data for the control with the given path.

    For example, for the following FormGroup:

    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']
    2. A period-delimited list of control names in one string, e.g. 'address.street'
  • Parameters

    • errorCode: string

      The code of the error to check

    • Optionalpath: string | (string | number)[]

      A list of control names that designates how to move from the current control to the control that should be queried for errors.

    Returns boolean

    whether the given error is present in the control at the given path.

    If the control is not present, false is returned.

    Reports whether the control with the given path has the error specified.

    For example, for the following FormGroup:

    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']
    2. 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 void

  • Returns void

  • Parameters

    • Optionalvalue: any

    Returns void

    Resets the control with the provided value if the control is present.