angularjs - paginate ng-repeat items which are filtered using filter:query -


i trying filter|query on list of items in angular paginated.

the problem filter|query works on paginated items, paginate filtered items, rather vice-versa.

for example:

  1. list of items
  2. paginate
  3. if filtered, paginate filtered items

create own filter, check if data passed item paginated , apply filter algorithm.

mymodule.filter('filteronlypaginated', function() { return function(data) {   if(data.ispaginated()) {     return data....   }   else {     return data;   } }}); 

edit: maybe limitto usefull https://docs.angularjs.org/api/ng/filter/limitto

<div ng-repeat="item in items track item.id | filter:query | limitto:10">{{item.name}}</div> 

2nd edit: use

<div ng-repeat="item in filterfunction(items)"></div> 

filterfunction is:

.controller('yourcontroller', function($scope, $filter) {     $scope.filterfunction = function(items) {         return $filter('filtername')(items);     }; }); 

https://docs.angularjs.org/api/ng/filter/filter


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -