I'm using AngularJS and here's my code:
Controller
$scope.totalItems = $scope.lists.length;
$scope.currentPage = 1;
$scope.numPerPage = 8;
$scope.paginate = function (value) {
var begin, end, index;
begin = ($scope.currentPage - 1) * $scope.numPerPage;
end = begin + $scope.numPerPage;
index = $scope.lists.indexOf(value);
return (begin <= index && index < end);
}
Index
<pagination total-items="totalItems" ng-model="currentPage"
max-size="5" boundary-links="true"
items-per-page="numPerPage" class="pagination-sm">
</pagination>
Screenshot
My problem is that I want to display my data on different pages (paging), not on a single one.
How can I do that?
Update
for (var i = 0; i < 100; i++) {
$scope.lists.push('To do ' + i);
}