In my code, there is an ng-repeat that generates a table based on one loop, and within each row, another cell is populated based on a different loop:
<tbody>
<tr ng-repeat="r in roles | limitTo: 30">
<td>{{r.name}}</td>
<td>
<span ng-repeat="t in users100 | limitTo: r.userLimit" ng-if="t.role == r.name"><a href="{{t.id}}">{{t.full_name}}</a></span>
<span ng-if="true"><a href="" ng-click="r.userLimit=500">Show all</a></span>
</td>
</tr>
</tbody>
Each row represents a Role, with the first cell displaying the role's name.
The second cell displays results from a secondary dataset where the role
matches the original set's role
value. It repeats a SPAN
element for each match up to a limit of r.userLimit
, which is initially set to 20 in the JSON data.
The link within the A tag triggers an action that sets the value of r.userLimit
to 500, displaying all users.
The issue arises when I only want to display this link if the number of matching items in the initial repeater exceeds the value of r.userLimit
(which is 20).
I attempted to use the following syntax:
ng-if="((t.role == r.name).length > r.userLimit)"
However, the link doesn't appear. What am I doing wrong with my syntax?