title: Angular2 - Dynamic Form Inputs
body: <p>I am returning the following object from my API call:</p>
  
  <pre><code>"users": [
        {
          "id": 1,
          "name": "John",
          "email": "john@company",
          "created_at": "2016-09-08 03:53:43",
          "updated_at": "2016-09-09 15:05:13",
          "company_status": {
            "status": "1"
          }
        },
        {
          "id": 2,
          "name": "Moderator",
          "email": "mod@company.com",
          "created_at": "2016-09-08 15:26:20",
          "updated_at": "2016-09-08 15:26:25",
          "company_status": {
            "status": "0"
          }
        }
      ]
  </code></pre>
  
  <p>I'm trying to loop through it to create dynamic form inputs as so:</p>
  
  <pre><code>&lt;tr *ngFor="let user of users"&gt;
      &lt;td&gt;&lt;input formControlName="user_name" class="form-control" type="text" name="user_name"&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input formControlName="user_email" class="form-control" type="text" name="user_email"&gt;&lt;/td&gt;
      &lt;td&gt;
      &lt;div class="input-switch"&gt;
          &lt;input [attr.id]="'toggle_' + user.id" [formControlName]="'user_status_' + user.id" class="toggle" type="checkbox" value="{{ user.company_status.status }}"&gt;
          &lt;label [attr.for]="'toggle_' + user.id" class="input-toggle-xs"&gt;&lt;/label&gt;
      &lt;/div&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>But in my ngOnIit method on the component, I build the form initially as such:</p>
  
  <pre><code>    ngOnInit() {
          // Build the form
          this.companyForm = this.formBuilder.group({
              'user_name' : ['', Validators.required],
              'user_email'   : ['', Validators.required]
          });
        }
  </code></pre>
  
  <p>Since the user status inputs are generated dynamically, the form builder does not know about them and I get the following error:</p>
  
  <pre><code>EXCEPTION: Error in edit.template.html:74:87 caused by: Cannot find control with name: 'user_status_1'
  </code></pre>
  
  <p>Is it currently possible in Angular 2 to generate dynamic inputs so that my form can see them and keep track of the values?</p>