I have a table of orders, and depend on the order type i want to change the value of the td
. below is my view:
<tr ng-repeat="invoice in allInvoices">
<td>{{invoice.order_type}}</td>
<td>{{invoice.order_date}}</td>
<td>{{invoice.totalPrice}}</td>
<td>{{invoice.client_name}}</td>
</tr>
i tried:
<td ng-if="invoice.order_type='M'">Mobile</td>
<td ng-if="invoice.order_type='A'">Accessories</td>
but this don't fit with my table view since it will show two td
, while i want to keep on one td
but change it's value depends on the order type.
Thanks in advance!
you can just use an expression like
{{invoice.order_type == 'M' ? 'Mobile' : invoice.order_type == 'A' ? 'Accesories' : 'other'}}
the scheme is the following:
{{expression ? ifTrue : otherExpression ? ifTrue : anotherExpression ? ifTrue : ifFalse}}