Reputation: 407
This is my ng-repeat
<tr ng-repeat="userList in userLists" ng-if="userLists.role!='admin'">
<td data-th="S.no">{{$index+1}}</td>
<td data-th="Role">{{userList.role}}</td>
<td data-th="Email">{{userList.email}}</td>
<td data-th="Mobile">{{userList.mobile}}</td>
<td data-th="Downloads">0</td>
</tr>
i want to hide admin from the user list. but the problem is, that also hide that $index value.
then how to hide that properly...
Upvotes: 0
Views: 1059
Reputation: 2232
If users with 'admin' role should only be displayed
<tr ng-repeat="userList in userLists | filter:{role:'admin'}" >
<td data-th="S.no">{{$index+1}}</td>
<td data-th="Role">{{userList.role}}</td>
<td data-th="Email">{{userList.email}}</td>
<td data-th="Mobile">{{userList.mobile}}</td>
<td data-th="Downloads">0</td>
</tr>
If users with 'user' role should only be displayed
<tr ng-repeat="userList in userLists | filter:{role:'user'}" >
<td data-th="S.no">{{$index+1}}</td>
<td data-th="Role">{{userList.role}}</td>
<td data-th="Email">{{userList.email}}</td>
<td data-th="Mobile">{{userList.mobile}}</td>
<td data-th="Downloads">0</td>
</tr>
Upvotes: 3