0

I'm using the Justified Gallery jQuery plugin to work with Angular. I need to call the updateJustify() function after the ng-repeat has reordered itself. I suspect what is happening now is that when I change the sortorder it updates the gallery before it has even reordered. Is there a directive that can help me or any workarounds?

Please note this isn't for the first run through of 'ng-repeat'. I need to detect when the reordering of my ng-repeat has been completed so I can call my own function.

Here's the code from my 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>

Thanks

  • Possible duplicate of http://stackoverflow.com/questions/13471129/angularjs-ng-repeat-finish-event – meskobalazs Dec 30 '14 at 10:52
  • ^ You've misunderstood my question. I need to detect when my reordering of ng-repeat has finished NOT the first time ng-repeat has gone through. – Lachlan Tweedie Dec 30 '14 at 11:11
  • possible duplicate of [Angularjs directive wrapping ng-repeat](http://stackoverflow.com/questions/24361576/angularjs-directive-wrapping-ng-repeat) – JLRishe Dec 30 '14 at 11:15
  • Correct me if I'm wrong but that only gets called at the start after the first time ng-repeat has been rendered. I need to detect every time the loop has been reordered via the orderBy filter – Lachlan Tweedie Dec 30 '14 at 11:29

1 Answers1

0

You can try $timeout how a promise, but it's not guaranteed that call at the end of ng-repeat.

Felipe
  • 1
  • 1