Batman Batman - 1 month ago 6
AngularJS Question

How to use ng if else in one html tag to derive the condition

Can anyone help me solving the below issue, Currently I am using below code to display the values where i am using the two

<td>
tags derive the conditional values , Is there any way I can do kind of else in one
<td>
tag?

<td class="features" ng-if="OrderStatus.length>0">
<span ng-repeat="indi in ServiceDisconnects.Service">{{indi.serviceID}}<br></span>
</td>

<td class="features" ng-if="!OrderStatus.length>0">
<span ng-repeat="indi in ServiceDisconnects.Service">{{indi.productID}}<br></span>
</td>

Answer

Why dont you check it inside ng-repeat

<td ng-repeat="indi in ServiceDisconnects.Service">
<span ng-if="OrderStatus.length>0" >{{indi.serviceID}}<br></span>
<span ng-if="!OrderStatus.length>0" >{{indi.serviceID}}<br></span>
</td>