Kamel Mili Kamel Mili - 2 years ago 421
Javascript Question

ng-if inside ng-repeat in a table AngularJs

hey everyone am trying to use ng-if inside ng-repeat my condition is

if {{dev[2]}} == ""
i wanna display in the
<td>Non Valide</td>
else i just wanna display the data inside the dev i've been looking about a lot of exemples but nothing look the same cause am trying to use if else does it even possible to make it this way here's my code :

<table class="table table-bordered" >
<thead><tr class="infoti" >
<th>Id Dev</th>
<th>Nom Dev </th>
<th>Nom Ecu</th>
<tr dir-paginate=" dev in devs | itemsPerPage:7 ">
<td >{{dev[0]}}</td>
<td ng-if({{dev[2]}} != "") >non validé</td>

<td><button class="btn btn-gray" ng-click="displaydata(dev[0])" data-toggle="modal" data-target="#myModal" >Validé</button></td>

any help would be appreciated

Answer Source

You could use ng-bind to bind conditional data on view.

<td ng-bind="dev[2] != ''? 'Non Validé': 'Validé'"></td>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download