It is necessary to obtain a set of objects on the page (not the entire set, but only the one displayed on the current page), when using dirPagination in AngularJS 1.5. ng-inspector shows nothing except the main set. According to the thoughts go in the direction of an additional similar filter, but how to implement?

    1 answer 1

    It is very difficult to move to the paradigm of working with objects from the side of JS. The solution turned out to be easy and simple:

    $scope.pageItems = function () { var start= ($scope.Items.length > $scope.itemsPerPage ? $scope.itemsPerPage : 0) * ($scope.currentPage - 1); var end = ($scope.Items.length > $scope.itemsPerPage ? $scope.itemsPerPage : $scope.Items.length) * ($scope.currentPage); return $scope.Items.slice(start, end ); } 

    $scope.Items - All $scope.Items data. $scope.pageItems - All current DISPLAYED data.