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
Use ngStyle with a method as expression. Add the following method to your component:
public getColor(balance: number): string{ return balance > 0 ? "green" : "red"; }
And in template use it as expression:
0" [ngStyle]="{'color': getColor(row.availableBalance)}"> {{row.availableBalance}}