I have the following (simplified) example where I dont get why my function gets called a lot more often then my ng-repeat renders content. (Code shows the issue better than I can explain it).
(I did read about ng-repeat-start / ng-repeat-end but I can't see how this helps me here.)
Thanks in advance for any helping input!
<table>
<tr>
<th><strong>Date</strong></th>
<td ng-repeat="day in days">
<!-- Where days is an array containing 6 dates -->
{{day | date : 'EEE d'}}
</td>
</tr>
<tr>
<th><strong>Participants</strong></th>
<td ng-repeat="day in days">
<span ng-if="!userParticipates(1)"><a href="">User does not participate</span>
<!-- This gets rendered 6 times but the function userParticipates() gets called 36 times (6*6?) - Why is that the case?-->
</td>
</tr>
Update
Thank you for your answer, Woot4Moo! I am sorry, I am still confused:
You say my code generates this:
<span ng-if="!userParticipates(1)"><a href="">User does not participate</span>
<span ng-if="!userParticipates(1)"><a href="">User does not participate</span>
<span ng-if="!userParticipates(1)"><a href="">User does not participate</span>
<span ng-if="!userParticipates(1)"><a href="">User does not participate</span>
<span ng-if="!userParticipates(1)"><a href="">User does not participate</span>
<span ng-if="!userParticipates(1)"><a href="">User does not participate</span>
But thats actually not what I see. I have the 'User does not participate' only once each row (6 times). It's only the function inside the ng-if which gets called 36 times. I don't see why, because my ng-repeat's don't seem to be nested into each another...?