Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <div data-pagination="" data-num-pages="numOfPages()"
  2. data-current-page="curPage" data-max-size="maxSize"
  3. data-boundary-links="true">
  4. </div>
  5.  
  6. $scope.curPage = 1,
  7. $scope.itemsPerPage = 13,
  8. $scope.maxSize = 5;
  9.  
  10.  
  11.  
  12. $scope.numOfPages = function () {
  13. //pagination calculating total of pages
  14. return Math.ceil($scope.banklines.length / $scope.itemsPerPage);
  15.  
  16. };
  17.  
  18. $scope.filterItems = function(){
  19. if($scope.banklines != undefined){
  20. var begin = (($scope.curPage - 1) * $scope.itemsPerPage),
  21. end = begin + $scope.itemsPerPage;
  22.  
  23. $scope.filteredItems = $scope.banklines.slice(begin, end);
  24. $scope.$apply();
  25. }
  26. }
  27.  
  28. $scope.$watch('curPage + numPerPage', $scope.filterItems());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement