Using Angular filter with pagination
Try,
HTML,
<li ng-repeat="item in filterData = (totalItems | filter : {itemName: filterText}) | limitTo:3:3*(page-1)">
and
<uib-pagination class="pagination-sm pagination" total-items="filterData.length" ng-model="page"
ng-change="pageChanged()" previous-text="‹" next-text="›" items-per-page=3></uib-pagination>
JavaScript,
$scope.pageChanged = function() {
//var startPos = ($scope.page - 1) * 3;
//$scope.displayItems = $scope.totalItems.slice(startPos, startPos + 3);
};
https://plnkr.co/edit/m3jXsxsCGfqKCJYHsw0u?p=preview
You can access the filtered array by using as alias
in ng-repeat
expression
<li ng-repeat="item in displayItems | filter : {item_name: filterText} as filteredArray">
Then use that alias for total-items
in pagination
<uib-pagination class="pagination-sm pagination"
total-items="filteredArray.length" ng-model="page" ng-change="changeItems()">
</uib-pagination>