0

I want to change class based on the value in my Angular 4 app.

My Code:

<td [ngClass]="{'green': crypto.percent_change_1h < 0, 'red': crypto.percent_change_1h > 0}">

It is not working as expected? why

I have gone through many links, I could not find solutions,

https://github.com/angular/angular/issues/13107

https://github.com/angular/angular.js/issues/9109

Applying ng-class based on value

How to give color to h2 based on positve or negative number angular 4 and more.

I know, it can be done using Javascript. It could be better it is possible from Angular itself.

Aravin
  • 6,605
  • 5
  • 42
  • 58

0 Answers0