I am trying to use ngclass for my condition to apply css for the below html code but it was showing error.
I want to use two class that is colorRed & colorOrange
Here is my Two class (CSS)
.colorRed{
color:red;
}
.colorOrange{
color: orange;
}
Here is condition
- If percentage is >=5% and <10%, show orange color
- If percentage is >=10% need to show red color
Here is my html
<ng-container matColumnDef="salaryIncrease">
<th mat-header-cell *matHeaderCellDef mat-sort-header> </th>
<td mat-cell [ngClass]="{'colorRed': element.salaryIncrease>= 5% }" *matCellDef="let element" > {{element.salaryIncreas| currency:'':''}}
</td>
</ng-container>
element.salaryIncrease>= 5%this will not work. You should not use%in comparison - its not an operator in JS. - Wand Maker