title: how to get value in FormGroup using formarray
body: <p>I have created a HTML form that has text field and drop down and it can also be created dynamically. when i am clicking submitting button it is only taking value of one component and not taking value of another text field. Form control name of both are same. But i am getting value of one control.</p>
  
  <p>HTML:-</p>
  
  <pre><code>&lt;div class="container"&gt;
    &lt;p&gt; &lt;/p&gt;
    &lt;div&gt;
        &lt;form [formGroup]="searchForm" novalidate (ngSubmit)="submit()"&gt;
            &lt;div formArrayName="properties"&gt;
              &lt;div *ngFor="let prop of searchForm.get('properties').controls; let i = index" &gt;
                &lt;input type="text" class="form-control" [formControlName]="i"&gt;
                &lt;select class="form-control" [formControlName]="i"&gt;
                    &lt;option value="x"&gt;x&lt;/option&gt;
                    &lt;option value="y"&gt;y&lt;/option&gt;
                    &lt;option value="xy"&gt;xy&lt;/option&gt;
                    &lt;option value="z"&gt;z&lt;/option&gt;
                  &lt;/select&gt;
                  &lt;button *ngIf="searchForm.controls['properties'].length &gt; 1 " (click)="onDelProperty(i)"&gt;Delete&lt;/button&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;p&gt;
            &lt;/p&gt;
            &lt;a (click)="onAddProperty()"&gt;Add&lt;/a&gt;
            &lt;button class="btn btn-bold btn-primary" type="submit"&gt;submit&lt;/button&gt;
        &lt;/form&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>component:- </p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { FormGroup, FormBuilder, FormArray, FormControl } from '@angular/forms';
  import { IcoService } from '../../services/ico.service';
  import { debug } from 'util';
  
  @Component({
    selector: 'app-team',
    templateUrl: './team.component.html',
    styleUrls: ['./team.component.css']
  })
  export class TeamComponent implements OnInit {
    searchForm: FormGroup;
    constructor(private fb: FormBuilder,private icoService: IcoService,) { }
  
    ngOnInit() {
      this.searchForm = this.fb.group({
        properties: this.fb.array([])
      });
      this.onAddProperty(); //calling this first time so that by default input components will be there and single user should be added
    }
  
    submit() {
      console.log(this.searchForm.value);
      debugger
        this.icoService.teamDetail(this.searchForm.value).subscribe((result) =&gt; {
          console.log()
        }, (err) =&gt; { console.log('err',err) })
    }
  
    onAddProperty() {
      for(var i=1; i&lt;=1; i++) {
        (this.searchForm.get('properties') as FormArray).push(new FormControl());
      }
    }
  
    onDelProperty(index:any) {
      for(var i=1; i&lt;=1; i++) {
        (this.searchForm.get('properties') as FormArray).removeAt(index);
      }
    }
  
  }
  </code></pre>