Search code examples
angularjsngtable

ngTable with ng-if is not working


I'm using ng-table with angularJs as shown below.My problem is when I use ngTable it's rendered same column twice (MyColumn).In other words it doesn't consider the ng-if.How can I get rid of that issue ?

Note : But for the normal table it's working fine.Why is that not working with the ngTable ?

ngTable

<table ng-table="TableParams" class="table" template-pagination="custom/pager">

    <tr ng-repeat="item in My.Items">
      <td ng-if="(item.Value | uppercase) == 'NO'" data-title="'MyColumn'" sortable="'Value'">{{item.Value}}</td>
       <td ng-if="(item.Value | uppercase) == 'YES'" data-title="'MyColumn'" sortable="'Value'">{{item.Value}}</td>
      </tr>
</table>

Solution

  • I did it as shown below.It works fine. Hurray :D

      <tr ng-repeat="item in My.Items">
    
       <td data-title="'MyColumn'" sortable="'Value'">
    
          <span ng-if="(item.Value | uppercase) == 'NO'">{{item.Value}}</span>
          <span ng-if="(item.Value | uppercase) == 'YES'">{{item.Value}}</span>
    
       </td>
     </tr>