I am trying to create a table that displays columns with the format {key: string, display: string} where 'display' is the header and 'key' is used to display the value.
<ng-container *ngFor="let col of displayedColumns">
<th mat-header-cell *matHeaderCellDef> {{ renderHeader(col.display) }} </th>
<td mat-cell *matCellDef="let element"> {{ element[col.key] }} </td>
</ng-container>
However, I am encountering an error:
UniversalTableComponent.html:2 ERROR Error: Could not find column with id "[object Object]".
at getTableUnknownColumnError (table.js:890)
at table.js:1973
at Function.from (<anonymous>)
at MatTable._getCellTemplates (table.js:1965)
at MatTable._renderRow (table.js:1920)
at table.js:1779
at Array.forEach (<anonymous>)
at MatTable._forceRenderHeaderRows (table.js:1774)
at MatTable.ngAfterContentChecked (table.js:1251)
at callProviderLifecycles (core.js:32324)