angularjsangular-ui-gridangular-ng-ifui-grid

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


How to show NO VALUE if column value is DB Null in angularjs ui grid. I tried using the code as below but it does not work. Am i missing anything.

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>'

Solution

  • (moved from comment)

    I think your brackets/quotes are a bit unbalanced. Maybe this does the trick:

    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>'