I am trying to do a pagination for my list of informations. Currently, there is two buttons which are previous and next button. The previous button is working but the next button is working but its continously working. Actually, I want it to be disabled once the end of the list has been reached. But now I can still click on the next button.
How do I solve this bug?
This is my pagination code:
<div ng-show="filteredItems > 0">
<ul class="pagination" page="currentPage">
<li ng-class="{disabled: currentPage == 1}">
<a href ng-click="prevPage()">« Prev</a>
</li>
<li ng-class="{disabled: currentPage == totalItems - 1}">
<a href ng-click="nextPage()">Next »</a>
</li>
</ul>
</div>
This is my controller.js code:
$scope.nextPage = function () {
if ($scope.currentPage < $scope.totalItems - 1) {
$scope.currentPage++;
console.log($scope.totalItems);
}
};
}