title: Iterate through dataSource in mat-table Angular
body: <p>I have problem with iterations through dataSource, where I have data for mat-table</p>
  
  <pre><code>   &lt;div *ngFor="let element of arrayMain" id = "{{element}}" class="my_item"&gt;
        &lt;div&gt;&lt;span class="skuska"&gt;&lt;span class="mat-subheading-2"&gt;{{element}}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
        &lt;mat-table #table [dataSource]="dataSource[1]" matSort&gt;
          &lt;ng-container matColumnDef="{{column.id}}" *ngFor="let column of columnNames"&gt;
            &lt;mat-header-cell *matHeaderCellDef mat-sort-header &gt; {{column.value}} &lt;/mat-header-cell&gt;
            &lt;mat-cell *matCellDef="let element" [style.background]="element[column.id].color"&gt; &lt;div class="mat-cell-inner"&gt;{{element[column.id].name}}&lt;/div&gt;&lt;/mat-cell&gt;
  
          &lt;/ng-container&gt;
  
          M:&lt;mat-header-row *matHeaderRowDef="displayedColumns"&gt;&lt;/mat-header-row&gt;
          &lt;mat-row *matRowDef="let row; columns: displayedColumns;"&gt;&lt;/mat-row&gt;
        &lt;/mat-table&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>The row with this data contain the problem</p>
  
  <pre><code>&lt;mat-table #table [dataSource]="dataSource[1]" matSort&gt;
  </code></pre>
  
  <p>I can only change the data when i change the number inside the array:</p>
  
  <pre><code>dataSource[0],dataSource[1]....,dataSource[n]
  </code></pre>
  
  <p>I try to use *ngFor cause</p>
  
  <pre><code>&lt;mat-table *ngFor = "let calendars of dataSource" #table [dataSource]="{{calendars}}" matSort&gt;
  </code></pre>
  
  <p>but it displays an error:</p>
  
  <pre><code>ng: Parser Error: Got interpolation ({{}}) where expression was expected at column 0 in [{{calendars}}] in @101:73
  </code></pre>
  
  <p>I fill the dataSource in function</p>
  
  <pre><code>for(identificator = 0; identificator &lt; n; identificator++)
         createData(identificator) 
  
  createData(identificator) {
     some code...
         .
         . 
         .
      this.dataSource[identificator] = new MatTableDataSource(testData);
      this.dataSource[identificator].sort = this.sort;
  
  }
  </code></pre>
  
  <p>How can I fix it? Any ideas? Thank you !</p>