
p.location-badge.
  exported from <a href='../forms'>angular2/forms</a>
  defined in <a href="https://github.com/angular/angular/tree/3a0410a/modules/angular2/src/forms/directives/ng_control_name.ts#L13-L114">angular2/src/forms/directives/ng_control_name.ts (line 13)</a>

:markdown
  Creates and binds a control with a specified name to a DOM element.
  
  This directive can only be used as a child of <a href='NgForm-class.html'><code>NgForm</code></a> or <a href='NgFormModel-class.html'><code>NgFormModel</code></a>.
  
  # Example
  
  In this example, we create the login and password controls.
  We can work with each control separately: check its validity, get its value, listen to its
   changes.
  
   ```
  @Component({selector: "login-comp"})
  @View({
       directives: [formDirectives],
       template: `
               <form #f="form" (submit)='onLogIn(f.value)'>
                 Login <input type='text' ng-control='login' #l="form">
                 <div *ng-if="!l.valid">Login is invalid</div>
  
                 Password <input type='password' ng-control='password'>
  
                 <button type='submit'>Log in!</button>
               </form>
       `})
  class LoginComp {
   onLogIn(value) {
     // value === {login: 'some login', password: 'some password'}
   }
  }
   ```
  
  We can also use ng-model to bind a domain model to the form.
  
   ```
  @Component({selector: "login-comp"})
  @View({
       directives: [formDirectives],
       template: `
               <form (submit)='onLogIn()'>
                 Login <input type='text' ng-control='login' [(ng-model)]="credentials.login">
                 Password <input type='password' ng-control='password'
   [(ng-model)]="credentials.password">
                 <button type='submit'>Log in!</button>
               </form>
       `})
  class LoginComp {
   credentials: {login:string, password:string};
  
   onLogIn() {
     // this.credentials.login === "some login"
     // this.credentials.password === "some password"
   }
  }
   ```
  
.l-main-section
  h2 Members
  .l-sub-section
    h3 constructor

    
    pre.prettyprint
      code.
        constructor(_parent: ControlContainer)
    
    :markdown
      
      




  .l-sub-section
    h3 ngModel

    
    :markdown

      
      





  .l-sub-section
    h3 model

    
    :markdown

      
      





  .l-sub-section
    h3 onChange

    
    pre.prettyprint
      code.
        onChange(c: StringMap&lt;string, any&gt;)
    
    :markdown

      
      





  .l-sub-section
    h3 onDestroy

    
    pre.prettyprint
      code.
        onDestroy()
    
    :markdown

      
      





  .l-sub-section
    h3 viewToModelUpdate

    
    pre.prettyprint
      code.
        viewToModelUpdate(newValue: any)
    
    :markdown

      
      





  .l-sub-section
    h3 path

    
    :markdown

      
      





  .l-sub-section
    h3 formDirective

    
    :markdown

      
      





  .l-sub-section
    h3 control

    
    :markdown

      
      




