的乘法我有,我不明白为什么我的功能被更频繁地叫了很多以下(简化)例如然后我NG重复呈现的内容调用。 (代码显示的问题比我可以解释的更好)。搞不清楚为什么我的功能得到由NG-重复
(我没有读到NG-重复启动/ NG-重复结束,但我看不出这怎么会在这里帮助我。)
预先感谢任何帮助的投入!
<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>
更新
谢谢您的回答,Woot4Moo! 对不起,我仍然困惑:
你说我的代码生成此:
<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>
但是那其实不是我所看到的。我有'用户不参与'每行只有一次(6次)。它只是ng中的函数,如果它被调用了36次。我不明白为什么,因为我的重复似乎没有嵌套到另一个...?
这说明它更新了!也是好的建议,让控制器努力工作,只将boolean等同于HTML!谢谢! – Riscie 2014-10-27 20:33:22