The case here is I want to assign colour to each row of mat table based on some logic (for e.g orderId of the list) for orderId <= 1000
colour should be red, for 1000 < orderId <= 2000
, colour should be green and orderId > 2000
, colour should be yellow. I tried this but unable to achieve the desired output:
<mat-row *matRowDef="let row; columns: displayedColumns"
(click)="highlightedRows.push(row)"
[style.background]="highlightedRows.indexOf(row) != -1 ? backgroundColor : ''">
</mat-row>
Any help will be appreciated.