GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Tutorials
  • Playground
  • Reference
  • code
  • FormArray
  • Reactive Forms Guide
  • AbstractControl
  • EventEmitter
  • FormControlName
  • Form
  • FormControl
  • FormGroup
  • ValidationErrors

This view

  • Original page
  • New address

GeezerVison is showing angular.dev — FormArrayDirective • Angular

API

    
      class FormArrayDirective extends AbstractFormDirective {}
    
    

Tracks the FormArray bound to this directive.

Emits an event when the form submission has been triggered.

Returns the FormArray bound to this directive.

Reports whether the form submission has been triggered.

Tracks the list of added FormControlName instances

@paramchanges{ [propName: string]: SimpleChange<any>; }
@returnsvoid
@returnsvoid
@paramchanges{ [propName: string]: SimpleChange<any>; }
@returnsvoid
@returnsvoid

Returns this directive's instance.

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.

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.

@paramdirFormControlName

The FormControlName directive instance.

@returnsFormControl<any>

Retrieves the FormControl instance from the provided FormControlName directive

@paramdirFormControlName

The FormControlName directive instance.

@returnsFormControl<any>

Removes the FormControlName instance from the internal list of directives

@paramdirFormControlName

The FormControlName directive instance.

@returnsvoid

Adds a new FormGroupName directive instance to the form.

@paramdirFormGroupName

The FormGroupName directive instance.

@returnsvoid

Performs the necessary cleanup when a FormGroupName directive instance is removed from the view.

@paramdirFormGroupName

The FormGroupName directive instance.

@returnsvoid

Retrieves the FormGroup for a provided FormGroupName directive instance

@paramdirFormGroupName

The FormGroupName directive instance.

@returnsFormGroup<any>

Retrieves the FormArray for a provided FormArrayName directive instance.

@paramdirFormArrayName

The FormArrayName directive instance.

@returnsFormArray<any>

Performs the necessary setup when a FormArrayName directive instance is added to the view.

@paramdirFormArrayName

The FormArrayName directive instance.

@returnsvoid

Performs the necessary cleanup when a FormArrayName directive instance is removed from the view.

@paramdirFormArrayName

The FormArrayName directive instance.

@returnsvoid

Sets the new value for the provided FormControlName directive.

@paramdirFormControlName

The FormControlName directive instance.

@paramvalueany

The new value for the directive's control.

@returnsvoid

Method called when the "reset" event is triggered on the form.

@returnsvoid

Resets the form to an initial value and resets its submitted status.

@paramvalueany

The new value for the form.

@paramoptions{ onlySelf?: boolean | undefined; emitEvent?: boolean | undefined; }
@returnsvoid

Method called with the "submit" event is triggered on the form. Triggers the ngSubmit emitter to emit the "submit" event as its payload.

@param$eventEvent

The "submit" event object

@returnsboolean

The name for the control

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

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.

Reports whether the control is invalid, meaning that an error exists in the input value. If the control is not present, null is returned.

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.

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.

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.

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

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.

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.

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.

Reports the validation status of the control. Possible values include: 'VALID', 'INVALID', 'DISABLED', and 'PENDING'. If the control is not present, null is returned.

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 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 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.

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

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

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

@paramvalueany
@returnsvoid

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

@paramerrorCodestring

The code of the error to check

@parampathstring | (string | number)[] | undefined

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

@returnsboolean

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

If the control is not present, false is returned.

Usage notes

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.

Reports error data for the control with the given path.

@paramerrorCodestring

The code of the error to check

@parampathstring | (string | number)[] | undefined

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

@returnsany

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

Usage notes

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'

Description

Binds an existing FormArray to a DOM element.

This directive accepts an existing FormArray instance. It will then use this FormArray instance to match any child FormControl, FormGroup/FormRecord, and FormArray instances to child FormControlName, FormGroupName, and FormArrayName directives.

Exported by

  • ReactiveFormsModule

Usage Notes

Register Form Array

The following example registers a FormArray with first name and last name controls, and listens for the ngSubmit event when the button is clicked.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.