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:
- list of items
- paginate
- 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); }; });
Comments
Post a Comment