export class ControlArray
export class ControlArray
exported from angular2/common defined in angular2/src/common/forms/model.ts (line 411)
Defines a part of a form, of variable length, that can contain other controls.
A ControlArray aggregates the values and errors of each Control in the group. Thus, if
one of the controls in a group is invalid, the entire group is invalid. Similarly, if a control
changes its value, the entire group changes as well.
ControlArray is one of the three fundamental building blocks used to define forms in Angular,
along with Control and ControlGroup. ControlGroup can also contain
other controls, but is of fixed length.
Adding or removing controls
To change the controls in the array, use the push, insert, or removeAt methods
in ControlArray itself. These methods ensure the controls are properly tracked in the
form's hierarchy. Do not modify the array of AbstractControls used to instantiate
the ControlArray directly, as that will result in strange and unexpected behavior such
as broken change detection.
Example (live demo)
Constructor
constructor(controls: AbstractControl[], validator?: Function, asyncValidator?: Function)
constructor(controls: AbstractControl[], validator?: Function, asyncValidator?: Function)Not Yet Documented
Members
controls : AbstractControl[]
controls : AbstractControl[]
Not Yet Documented
at(index: number) : AbstractControl
at(index: number) : AbstractControl
Get the AbstractControl at the given index in the array.
push(control: AbstractControl) : void
push(control: AbstractControl) : void
Insert a new AbstractControl at the end of the array.
insert(index: number, control: AbstractControl) : void
insert(index: number, control: AbstractControl) : void
Insert a new AbstractControl at the given index in the array.
removeAt(index: number) : void
removeAt(index: number) : void
Remove the control at the given index in the array.
length : number
length : number
Length of the control array.