Batman Batman - 1 year ago 72
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

tags derive the conditional values , Is there any way I can do kind of else in one

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

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

Answer Source

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>