gpt4 book ai didi

javascript - ng-repeat 在状态更改时运行

转载 作者:行者123 更新时间:2023-11-27 22:39:35 25 4
gpt4 key购买 nike

我在 Angular 和 ionic 方面遇到了一个奇怪的问题。当退出到另一个状态时,我再次调用“ifPostExcluded”。

当中继器完成加载时也会调​​用此函数(请注意,我有自己的指令“on-finish-render”)来检测这一点。

<div ng-repeat="post in postList" on-finish-render="ngRepeatFinished">
<div class="{{post.id}}" ng-if="post.cat.length > 0">
<div class="w-col w-col-4 push-block-wrap" ng-if="ifPostExcluded(post.cat, post.id)">
<div ng-include src="'templates/_loop.html'"></div>
</div>
</div>

我很困惑为什么会发生这种情况。我发现this neat solution但在实现之前我宁愿尝试解决问题。

最佳答案

对于那些遇到类似问题的人,我按照这篇文章使用一次性绑定(bind)解决了这个问题。 AngularJs alternative to ng-if to save digest

关于javascript - ng-repeat 在状态更改时运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38857191/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com