title: Dynamically load multiple dropdown in formarray in angular 6
body: <p>I want to load two dropdown one dropdown is based on another dropdown.</p>
  
  <p>I am using formarray to load the form values. In my actual scenario, first i am loading values in *ngfor loop with form data(formarray). below image shows my example scenario.</p>
  
  <p><a href="https://i.stack.imgur.com/WIIap.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WIIap.jpg" alt="enter image description here"></a></p>
  
  <p>Img Brief: name, age, dob are like label field. only dropdowns are form.</p>
  
  <p>first i am loading values in view using *ngFor then i am loading values using form array.</p>
  
  <p>here on load it should load the dropdown values. if i am selecting first dropdown. it should change the second dropdown values. on load it self i am load the data in both the dropdown using service.</p>
  
  <p><strong>component.ts</strong></p>
  
  <pre><code>this.wholedata.foreach({ x =&gt;
   this.sampleservice.dropdown(x.firstdropdownvalue).subscribe({
    this.samplevalue = res;
    control.push({
     dropdownvalue1: x.firstdropdownvalue,
     dropdownvalue2: x.seconddropdownvalue
    })
   })
  })
  </code></pre>
  
  <p><strong>component.html</strong></p>
  
  <pre><code>&lt;div *ngFor="let data of datas"&gt;
   //formarray codes here placed
   &lt;span&gt;name: {{data.name}}&lt;/span&gt;
   &lt;span&gt;age: {{data.age}}&lt;/span&gt;
   &lt;span&gt;dob: {{data.dob}}&lt;/span&gt;
   &lt;span&gt;
    &lt;select formControlName="dropdownvalue1" (change)="changevalues($event)"&gt;
     &lt;option *ngFor="let data of dropdownvalue"&gt;{{data.values}}&lt;/option&gt;
    &lt;/select&gt;
   &lt;/span&gt;
   &lt;span&gt;
    &lt;select formControlName="dropdownvalue2"&gt;
     &lt;option *ngFor="let data of samplevalue"&gt;{{data.values}}&lt;/option&gt;
    &lt;/select&gt;
   &lt;/span&gt;
   &lt;button type="submit" (click)="submitValues()"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Currently <strong>samplevalue</strong> variable values loading to last *ngfor loop because the dynamic dropdown value is changing every array based on firstdropdown so i cant able to set the value.</p>