Reputation: 20100
For some condition, I would like replace a String in my model when displaying it in html. I could do this my modifying my model, but is there a more idiomatic option? Possibly this should be done with a filter?
<tr ng-repeat="i in ctrl.data" >
<td>
<div ng-show="i.category == 'default'">
none
</div>
<div ng-show="i.category != 'default'">
{{ i.category }}
</div>
</td>
</tr>
Upvotes: 0
Views: 22
Reputation: 691973
{{ i.category == 'default' ? 'none' : i.category }}
Or, if you have that in several places, use a filter.
Upvotes: 2