0

我正在使用 Justified Gallery jQuery 插件来处理 Angular。在 ng-repeat重新排序后,我需要调用 updateJustify() 函数。我怀疑现在发生的事情是,当我更改排序顺序时,它甚至会在重新排序之前更新图库。是否有可以帮助我的指令或任何解决方法?

请注意,这不是第一次运行“ng-repeat”。我需要检测我的 ng-repeat 的重新排序何时完成,以便我可以调用自己的函数。

这是我的 HTML 中的代码

<select  ng-model="sortorder" ng-change='updateJustify()'>
  <option value='' disabled selected> Filters </option>
  <option value="+title">Title (A-Z)</option>
  <option value="-title">Title (Z-A)</option>
  <option value="+created">Created (New-Old)</option>
  <option value="-created">Created (Old-New)</option>
</select>

<a href="#" data-ng-repeat='hero in heroarticles | orderBy: sortorder'">
 <img data-ng-src='{{hero.imgPath}}' alt="{{hero.title}}" />
</a>

谢谢

4

1 回答 1

0

您可以尝试 $timeout 如何承诺,但不能保证在 ng-repeat 结束时调用。

于 2014-12-30T10:55:40.707 回答