p.location-badge. exported from angular2/forms defined in angular2/src/forms/directives/ng_control_group.ts (line 12) :markdown Creates and binds a control group to a DOM element. This directive can only be used as a child of NgForm or NgFormModel. # Example In this example, we create the credentials and personal control groups. We can work with each group separately: check its validity, get its value, listen to its changes. ``` @Component({selector: "signup-comp"}) @View({ directives: [formDirectives], template: `
Login Password
Credentials are invalid
Name
`}) class SignupComp { onSignUp(value) { // value === {personal: {name: 'some name'}, // credentials: {login: 'some login', password: 'some password'}} } } ``` .l-main-section h2 Annotations .l-sub-section h3.annotation Directive pre.prettyprint code. @Directive({ selector: '[ng-control-group]', hostInjector: [controlGroupBinding], properties: ['name: ng-control-group'], lifecycle: [LifecycleEvent.onInit, LifecycleEvent.onDestroy], exportAs: 'form' }) .l-main-section h2 Members .l-sub-section h3 constructor pre.prettyprint code. constructor(_parent: ControlContainer) :markdown .l-sub-section h3 onInit pre.prettyprint code. onInit() :markdown .l-sub-section h3 onDestroy pre.prettyprint code. onDestroy() :markdown .l-sub-section h3 control :markdown .l-sub-section h3 path :markdown .l-sub-section h3 formDirective :markdown