angular-docs-cn/public/docs/js/latest/api/forms/ControlGroup-class.jade

152 lines
2.2 KiB
Plaintext
Raw Normal View History

2015-04-19 13:53:18 -07:00
2015-04-22 08:06:51 -07:00
p.location-badge.
2015-06-01 22:51:00 -07:00
exported from <a href='../forms'>angular2/forms</a>
defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/forms/model.ts#L106-L213">angular2/src/forms/model.ts (line 106)</a>
2015-04-19 13:53:18 -07:00
:markdown
Defines a part of a form, of fixed length, that can contain other controls.
2015-06-01 22:51:00 -07:00
A ControlGroup aggregates the values and errors of each <a href='Control-class.html'><code>Control</code></a> 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
2015-04-20 13:57:43 -07:00
changes as well.
2015-04-19 13:53:18 -07:00
2015-06-01 22:51:00 -07:00
`ControlGroup` is one of the three fundamental building blocks used to define forms in Angular,
along with
<a href='Control-class.html'><code>Control</code></a> and <a href='ControlArray-class.html'><code>ControlArray</code></a>. <a href='ControlArray-class.html'><code>ControlArray</code></a> can also contain other controls,
but is of variable
2015-04-20 13:57:43 -07:00
length.
2015-04-19 13:53:18 -07:00
.l-main-section
h2 Members
.l-sub-section
h3 constructor
pre.prettyprint
code.
2015-06-01 22:51:00 -07:00
constructor(controls: StringMap&lt;String, AbstractControl&gt;, optionals: StringMap&lt;String, boolean&gt; = null, validator: Function = Validators.group)
2015-04-19 13:53:18 -07:00
:markdown
2015-06-01 22:51:00 -07:00
.l-sub-section
h3 addControl
pre.prettyprint
code.
addControl(name: string, c: AbstractControl)
:markdown
2015-04-19 13:53:18 -07:00
.l-sub-section
h3 contains
pre.prettyprint
code.
2015-06-01 22:51:00 -07:00
contains(controlName: string)
2015-04-19 13:53:18 -07:00
:markdown
2015-04-19 13:53:18 -07:00
2015-06-01 22:51:00 -07:00
2015-04-19 13:53:18 -07:00
.l-sub-section
h3 controls
:markdown
2015-04-19 13:53:18 -07:00
2015-06-01 22:51:00 -07:00
2015-04-19 13:53:18 -07:00
.l-sub-section
h3 exclude
pre.prettyprint
code.
2015-06-01 22:51:00 -07:00
exclude(controlName: string)
:markdown
.l-sub-section
h3 find
pre.prettyprint
code.
find(path: string | List&lt;string&gt;)
2015-04-19 13:53:18 -07:00
:markdown
2015-04-19 13:53:18 -07:00
2015-06-01 22:51:00 -07:00
2015-04-19 13:53:18 -07:00
.l-sub-section
h3 include
pre.prettyprint
code.
2015-06-01 22:51:00 -07:00
include(controlName: string)
2015-04-19 13:53:18 -07:00
:markdown
2015-04-19 13:53:18 -07:00
2015-06-01 22:51:00 -07:00
.l-sub-section
h3 removeControl
pre.prettyprint
code.
removeControl(name: string)
:markdown
2015-04-19 13:53:18 -07:00