【问题标题】:ng-repeat running on state changeng-repeat 在状态变化时运行
【发布时间】:2016-08-13 16:42:58
【问题描述】:

我在角度和离子方面有一个奇怪的问题。退出到另一个状态时,我再次调用了“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,但在我实施它之前,我宁愿尝试解决这个问题。

【问题讨论】:

  • 你试过collection-repeat吗?
  • @e666 好点会尝试看看我会有所作为
  • @e666 这不起作用。我将不得不对此进行深入调试,但感谢您的帮助。

标签: javascript angularjs ionic-framework


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-09
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 2017-06-07
    • 1970-01-01
    相关资源
    最近更新 更多