How to get a filtered link to a dir-paginate comparison result

I am using angularjs v1.2.9 in my project. I am using dir-pagination to display a list of items in my web application. Several filters are also used to sort the list dynamically. Is there a way to get a dynamically sorted list in my controller? I tried the suggested solutions here . But they don't seem to work with dir-pagination.

<tr dir-paginate="person in contacts|filter:searchText|filter:groups|orderBy:['name','email'] | itemsPerPage : 10" 
+5
source share
1 answer

You can use the function to return filtered results when you need them.

 function getFilteredResults() { return $scope.$eval("person in contacts|filter:searchText|filter:groups|orderBy:['name','email']"); } 

And if you just want to filter the results, not the paginated results, you could.

 <dir-paginate="person in filteredPersons = (contacts|filter:searchText|filter:groups|orderBy:['name','email']) | itemsPerPage : 10"> 

And if you need a page of filtered results, you can handle this in your controller like this.

 function getFilteredPersonsOnPage() { var end; var start; var itemsPerPage = parseInt($scope.queryState.pageSize) || 999; start = ($scope.currentPage - 1) * itemsPerPage; end = start + itemsPerPage; return $scope.filteredPersons.slice(start, end); } 
+8
source

Source: https://habr.com/ru/post/1212184/


All Articles