A quick example is http://embed.plnkr.co/qKLWrClyYvyvGyIPLnLQ/preview . Browse the page and create an array that will be displayed
var app = angular.module('pagination', ['ui.bootstrap']);
app.controller('Example', function($scope){
$scope.lists = [
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,15
];
$scope.totalItems = $scope.lists.length;
$scope.currentPage = 1;
$scope.numPerPage = 8;
$scope.theActualDisplayList = [];
$scope.$watch('currentPage', function(page) {
if($scope.currentPage) {
var spliceFrom = ($scope.currentPage - 1) * $scope.numPerPage;
var offset = spliceFrom + $scope.numPerPage;
$scope.theActualDisplayList = [];
for (var i = spliceFrom; i < offset; i++) {
if(i === $scope.lists.length) return false;
$scope.theActualDisplayList.push($scope.lists[i]);
}
}
});
});
<body ng-app="pagination" ng-controller="Example">
<h1>Pagination.</h1>
<ul><li ng-repeat="i in theActualDisplayList track by $index">{{i}}</li></ul>
<pagination total-items="totalItems" ng-model="currentPage" max-size="5" boundary-links="true" items-per-page="numPerPage" class="pagination-sm"></pagination>
</body>
source
share