title: Build form control from array - Angular 4
body: <p>i have an angular4 form which is built using form builder. The code is as follows.</p>
  
  <pre class="lang-js prettyprint-override"><code>initializeFromControls() {
      let obj = {
        firstname: new FormControl('', ),
        lastname: new FormControl('', ),
        email: new FormControl('',
                [Validators.required,
                Validators.pattern("^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$")]),
        status: new FormControl('', ),
        role_id: new FormControl('')         
      }
      this.userFrm = this.formBuilder.group(obj);
    }
  </code></pre>
  
  <p>Now i have another field named account_ids which is an array. The account ids are fetched from the getAccounts api call.</p>
  
  <pre class="lang-js prettyprint-override"><code>ngOnInit() {
      this.initializeFromControls();
      this.getAccounts();
    }
  </code></pre>
  
  <p>For each account i need to show a checkbox and account name. The selected accounts are to be sent in the format 
  <code>account_ids: [1,2,3]</code></p>
  
  <p>How to achieve this using FormBuilder.</p>