I just started with a basic approach so I want to highlight row color conditionally its not throwing any error but does not apply the background-color to the row. I have 5 rows that have riskINdex
H
, Any idea what is implemented wrong in below code?
app.component.html
<div>
<mat-table>
<ng-container matColumnDef="eventType">
<mat-header-cell *matHeaderCellDef> Event Type </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.eventType}} </mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;" (click)="selectedRow(row)" [ngClass]="{ 'high': row.riskIndex === 'High'}"></mat-row>
</mat-table>
</div>
component.css
.high {
background-color: red;
}