I am following this but my case is slightly different with dynamic data (both Element and Columns) from Api let's say
Element_Data
{name: 'Hydrogen', weight: 1.0079, symbol: 'H'}
displayedColumn
["name","weight","symbol"]
In my case I loop into displayedColumn like this and push to column
for(var x = 0 ;x<this.displayedColumns.length;x++){
this.columns.push( {columnDef: this.displayedColumns[x], header: this.displayedColumns[x], cell:
(element: any) => `${ element.date}`});
}
this.displayedColumns = this.columns.map(c => c.columnDef);
this.DataSet = Observable.of(this.Element_Data);
Problem
This problem is with this statement
${ element.date}`}
as I am using dynamic data I cannot write static property name for each element it should be dynamic something like
{this.displayedColumns[x]}
so that the correct value will return on calling
<mat-cell *cdkCellDef="let row">{{ column.cell(row) }}</mat-cell>
I have also checked this but no luck in this case of "column as property name"
Please help me solve this.