gpt4 book ai didi

javascript - ng-class 没有像我预期的那样工作

转载 作者:行者123 更新时间:2023-11-29 21:42:44 25 4
gpt4 key购买 nike

在 ng-grid 中,我使用以下单元格模板,

cellTemplate: '<div class="ngCellText" ng-class="{\'red\': {{row.getProperty(col.field)}} > 15 , \'yellow\': {{row.getProperty(col.field)}} > 5 && {{row.getProperty(col.field)}} <= 15}">{{row.getProperty(col.field)}} </div>'

然而,它并没有像我期望的那样出现。有时它会在值为 0 时应用“红色”类。我不确定为什么会这样。

最佳答案

ng-class 指令不处理 {{}} 插值指令

ng-class="{'red': row.getProperty(col.field)}

关于javascript - ng-class 没有像我预期的那样工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32189521/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com