Want to call a function when ng-repeat has finished? If you need to call different functions for different ng-repeats on the same controller you can try something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | app.directive('filtered',function($timeout) { return { restrict: 'A',link: function (scope,element,attr) { var elm = element[0] ,nodePrototype = Node.prototype ,timeout ,slice = Array.prototype.slice ; elm.insertBefore = alt.bind(null,nodePrototype.insertBefore); elm.removeChild = alt.bind(null,nodePrototype.removeChild); function alt(fn){ fn.apply(elm,slice.call(arguments,1)); timeout&&$timeout.cancel(timeout); timeout = $timeout(altDone); } function altDone(){ timeout = null; console.log('Filtered! ...fire an event or something'); } } }; }); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.