角度:不能使用引导类“ text-white”使用ngClass更改颜色

问题描述

使用引导类“ text-white”不能使用ngClass更改颜色。

代码

[ngClass] = "{'text-white': log >= 5}"

解决方法

Demo如果log是数字,则语法正确。首先检查它是否为数字,然后确保该类在应用程序的CSS中具有样式属性

在组件css中将其添加到检查

.text-white{
  color:white;
}