如果 UI GRID 中的列值为 DB Null,如何将无值显示为文本

How to display No Value as text if Column value is DB Null in UI GRID

如果 angularjs ui 网格中的列值为 DB Null,如何显示 NO VALUE。我尝试使用下面的代码,但它不起作用。我是不是漏了什么。

cellTemplate: '<div class="ui-grid-cell-contents" ng-if="row.entity.VariancePercentage>{{row.entity.VariancePercentage | number:2}}</div><div class="ui-grid-cell-contents" ng-if="!row.entity.VariancePercentage">No Value</div>'

(从评论中移出)

我觉得你的brackets/quotes有点不平衡。也许这可以解决问题:

cellTemplate: '<div class="ui-grid-cell-contents"><span ng-if="row.entity.VariancePercentage">{{row.entity.VariancePercentage | number:2}}</span><span ng-if="!row.entity.VariancePercentage">No Value</span></div>'