我想根据Angular 4应用程序中的值更改类。
我的代码:
<td [ngClass]="{'green': crypto.percent_change_1h < 0, 'red': crypto.percent_change_1h > 0}">
它没有按预期工作?为什么
我经历了很多链接,我找不到解决方案,
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等等。
我知道,可以使用Javascript完成。从Angular本身可能会更好。