ng-class 没有像我预期的那样工作
ng-class is not working as I expect it to be
在 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 时应用 class 'red'。我不确定为什么会这样。
ng-class
指令不处理 {{}}
插值指令
ng-class="{'red': row.getProperty(col.field)}
在 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 时应用 class 'red'。我不确定为什么会这样。
ng-class
指令不处理 {{}}
插值指令
ng-class="{'red': row.getProperty(col.field)}