typescript 离子条件类css
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44022439/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ionic conditional class css
提问by Richard
I am using Ionic3, and have:
我正在使用 Ionic3,并且有:
<span class="char-left">{{REVIEW_MAX_LENGTH-ratingModel.review.length}} characters left</span>
I would like to conditionally change the class
value when another value is populated, i.e when ratingForm.controls.review.length > 0
change the values to class="char-left-error"
.
我想class
在填充另一个值时有条件地更改该值,即将ratingForm.controls.review.length > 0
值更改为class="char-left-error"
.
I did look at ng-class
, but cannot seem to get it to work.
我确实看过ng-class
,但似乎无法让它发挥作用。
Any help appreciated.
任何帮助表示赞赏。