ng2-table
ng2-table copied to clipboard
Change a single cell color
How do I change the color of a single cell based on a condition?
in an ordinary table I could do something like:
<table>
<tr>
<td [ngStyle]="{'background-color': cell.color}>
this cell's color is {{cell.color}}
</td>
<td>
// other columns keep the default color
</td>
</tr>
</table>
I do not see a way to achieve this through ng2-table.
@hgarc014 Is it possible to iterate over rows in html? I know for the fact that if you use [rows]="rows" then it will be populated but If i want to iterate over then how is it possible? The following I am doing but it doesn't work
<ng-table [config]="config" [columns]="columns">
<tr *ngFor="let row of rows">
<td>1</td>
<td>{{ row.eid }}</td>
<td>{{ row.rankValue }}</td>
<td>{{ row.reason.similarilty }}</td>
</tr>
</ng-table>