对于h2标签,以下代码的输出应该为绿色,但是为什么为普通黑色,所以呢?

问题描述 投票:0回答:1

不显示角码绿色

app.component.css

.text-success{color:green}

app.component.html

<h2 [ngClass]='borde'>Hello World</h2>

app.component.ts

showColor:true
public borde={text-success:this.showColor}
angular angular-material angular2-directives ng-class
1个回答
0
投票

您未将showColor设置为true。您将类型设置为true,但没有将值设置为true。如果将其更改为showColor = true,它将正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.