I'm having a problem where I am loading dynamic table headers from a server. However, when they load, instead of displaying across the table like they should they stack up in one column.
Here is the html:
<tr *ngFor="let title of headers">
<th class='table-header'>{{title['COLUMN_NAME']}}</th>
</tr>
</thead>
<tbody >
<tr *ngFor="let item of data | paginate : {itemsPerPage: 25, currentPage: p} ">
<td>{{item.ID}}</td>
<td>{{item['78d00422ce41_POWER']}}</td>
<td>{{item['78d00422ce41_TIME']}}</td>
<td>{{item['78d00422821c_POWER']}}</td>
<td>{{item['78d00422821c_TIME']}}</td>
</tr>
</tbody>
heres what the 'headers' array looks like:
[
{
"COLUMN_NAME":"ID"
},
{
"COLUMN_NAME":"78d00422ce41_POWER"
},
{
"COLUMN_NAME":"78d00422ce41_TIME"
},
{
"COLUMN_NAME":"78d00422821c_POWER"
},
{
"COLUMN_NAME":"78d00422821c_TIME"
}
]
If there's something I'm missing, or that I did wrong, please let me know!
<thead> <tr *ngFor="let title of headers"> <th class='table-header'>{{title['COLUMN_NAME']}}</th> </tr> </thead>works fine for me.