Answer the question
In order to leave comments, you need to log in
AngularJS. How to catch the exit event of the "ng-repeat" directive when sorting or filtering?
Hello!
I have the following code
<tr ng-repeat="row in $ctrl.rows | filter:$ctrl.filterBy | orderBy : $ctrl.order.by : $ctrl.order.reverse as results track by row.id"
ng-init="$ctrl.afterRepeat = results.length"
>
....
ng-init="$last && $ctrl.onRepeatEnd()"
....
Answer the question
In order to leave comments, you need to log in
From ng-repeat you can get the resulting array that is being rendered, you can try to track it.
Why filter in a template? Sort array in js and return already sorted array
function ctrl() {
var vm = this;
var array = [2,1,3];
vm.filteredRows= null;
function doFilter(array) {
//фильтруем...
return filtered;
}
vm.$onInit = function () {
vm.filteredRows= doFilter(array);
}
<tr ng-repeat="row in $ctrl.filteredRows></tr>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question