I've been trying to do pagination using angularjs. I've managed to get all the page numbers in an array but I'm not sure how to go about viewing only 10 pages at a time with the Next and Back buttons.
So far, I have an array of all the pages, a total number of all the records I wanna show on each page (30 of them on each page). Like so:
$scope.showPagingSequence = function () {
if ($scope.showNumberPagingStats) {
if ($scope.PageNum < $scope.dynamicReport.PageCount) {
for (var i = 1; i <= $scope.dynamicReport.PageCount; i++) {
$scope.PageNumbers.push(i);
}
}
}
}
This is how I implement it in my html,
<div ng-model="showPagingSequence()">
<ul class="pagination" ng-repeat="pages in PageNumbers">
<li><a href="#" ng-click="setPageNumber(pages)"> {{pages}}</a></li>
</ul>
</div>
How do I limit my pagination to only view a limited number of pages with a Next and Back button?