title: Create Form Groups Based on Number of Records
body: <p>I want to create FormGroups/FormArrays inside mat-expansion-panel based on number of records I have in my database. </p>
  
  <p>I have a group table <br>
  id | desc      <br>
  1  | Group 1 <br>
  2  | Group 2 <br></p>
  
  <p>I have detail table <br>
  id | desc         | group_id <br>
  1  | Detail 1.1   | 1 <br>
  2  | Detail 1.2   | 1 <br>
  3  | Detail 2.1   | 2 <br></p>
  
  <p>Now, I have this codes and it will loop based on number of records</p>
  
  <p>HTML</p>
  
  <pre><code> &lt;mat-expansion-panel *ngFor="let group of groups"&gt; &lt;!-- based on group table  --&gt;
     &lt;form [formGroup]="group.formGroup"&gt;
       &lt;div formArrayName="group.formArray" &gt; 
         &lt;div *ngFor="let detail of details"&gt; &lt;!-- based on detail table --&gt;
         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/form&gt;
   &lt;/mat-expansion-panel&gt;
  
  </code></pre>
  
  <p>TS</p>
  
  <pre><code> ????????
  </code></pre>
  
  <p>I know how to create form group and form array but doing it based on number of records that is divided by mat-expansion-panel... There's where my problem.</p>