ControlGroup

export class ControlGroup

exported from angular2/common defined in angular2/src/common/forms/model.ts (line 305)

Defines a part of a form, of fixed length, that can contain other controls.

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

ControlGroup is one of the three fundamental building blocks used to define forms in Angular, along with Control and ControlArray. ControlArray can also contain other controls, but is of variable length.

Example (live demo)

Constructor

constructor(controls: {[key: string]: AbstractControl}, optionals?: {[key: string]: boolean}, validator?: Function, asyncValidator?: Function)

Not Yet Documented

Members

controls : {[key: string]: AbstractControl}

Not Yet Documented

addControl(name: string, control: AbstractControl) : void

Add a control to this group.

removeControl(name: string) : void

Remove a control from this group.

include(controlName: string) : void

Mark the named control as non-optional.

exclude(controlName: string) : void

Mark the named control as optional.

contains(controlName: string) : boolean

Check whether there is a control with the given name in the group.