Reputation: 65860
I'm using Angular UI Grid.Can you tell me how to select a cell template according to the condition? I have tried as shown below. Obviously it is not working hence first one has been overridden by the second one always.Can you tell me how to do this ?
statusCellTemplate = '<div class="ui-grid-cell-contents" ng-
if="row.entity.statusDetails.length>=2"><label>[Multiple Statuses]</label></div>';
statusCellTemplate = '<div class="ui-grid-cell-contents" ng-
if="row.entity.statusDetails.length=1"><label>
{{row.entity.statusDetails[0].status.name}}</label></div>';
UPDATE : I have tried as shown below.But it always shows the last one.Do you know why ?
statusCellTemplate =
'<div class="ui-grid-cell-contents"><span ng-
if="row.entity.statusDetails.length>=2">[Multiple Statuses]
</span><span ng-if="row.entity.statusDetails.length=1">
{{row.entity.statusDetails[0].status.name}}</span></div>';
And tried with the ng-show
also.same result.No Luck :(
Upvotes: 0
Views: 1727
Reputation: 65860
My Bad.Condition was wrong :(
Here is the working sample :D
var statusCellTemplate =
'<div class="ui-grid-cell-contents"><span ng-
if="row.entity.statusDetails.length>=2">[Multiple Statuses]</span><span ng-
if="row.entity.statusDetails.length<2">{{row.entity.statusDetails[0].status.name}}
</span></div>';
Upvotes: 1