Skip to content

Instantly share code, notes, and snippets.

/controller.js
Created Dec 9, 2014

Embed
What would you like to do?
pagination
// Pagination
$scope.currentPage = 1;
$scope.numPerPage = 10;
$scope.maxSize = 5;
$scope.paginate = function (value) {
var begin, end, index;
begin = ($scope.currentPage - 1) * $scope.numPerPage;
end = begin + $scope.numPerPage;
index = $scope.items.indexOf(value);
return (begin <= index && index < end);
};
<table>
<thead><tr><th>#</th><th>Document Name</th></tr></thead>
<tbody>
<tr data-ng-repeat="di in documentItems | filter : paginate">
<td>{[{$index+1}]}</td>
<td>{[{di.name || '---'}]}</td>
</tr>
</tbody>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.