What it does
Creates and binds a FormGroup
instance to a DOM element.
How to use
This directive can only be used as a child of NgForm
(or in other words,
within <form>
tags).
Use this directive if you'd like to create a sub-group within a form. This can come in handy if you want to validate a sub-group of your form separately from the rest of your form, or if some values in your domain model make more sense to consume together in a nested object.
Pass in the name you'd like this sub-group to have and it will become the key
for the sub-group in the form's full value. You can also export the directive into
a local template variable using ngModelGroup
(ex: #myGroup="ngModelGroup"
).
npm package:
@angular/forms
NgModule:
FormsModule
Class Overview
class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {
constructor
(parent: ControlContainer, validators: any[], asyncValidators: any[])
name
: string
}
Selectors
[ngModelGroup]
Exported as
ngModelGroup
Class Description
exported from @angular/forms/index, defined in @angular/forms/src/directives/ng_model_group.ts