I\'m working with Angular 4 and I have a problem with conditional style changing. I have a table and values in it. I need the values in a column to be changed depending if t
You could use ngClass for this. https://angular.io/api/common/NgClass
Available balance
0,
'negative' : row.availableBalance < 0
}"
>{{row.availableBalance}}
In your CSS:
.positive {
background-color: green;
}
.negative {
background-color: red;
}
This will leave 0 unstyled.
Very simple Stackblitz example: https://stackblitz.com/edit/angular-z2hnrn