I'm just trying to implement a condition row formatting in a table but it is not working.
The code is very simple:
<style type="text/css">
.red {
color: red;
}
.blue {
color: blue;
}
</style>
<tr *ngFor="let c of customers" [class.selected]="c === selectedItem" ng-class="{1==1 ? 'red': 'blue'}">
The condition 1==1
is always true
, and should render the red class, but it doesn't apply either red or blue class.
I created this example.
<div>
<h2 [ngClass]="1==1?'red':'blue'">Hello {{name}}</h2>
</div>