Skip to content

Instantly share code, notes, and snippets.

@qazimobeen
Created May 14, 2018 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qazimobeen/3d49f2ca4c84f299d91c125912db2779 to your computer and use it in GitHub Desktop.
Save qazimobeen/3d49f2ca4c84f299d91c125912db2779 to your computer and use it in GitHub Desktop.
$scope.pageSizeChanged = function () {
var begin = 0; // if you change page size anytime it always starts from begining
var end = parseInt($scope.pageSize.value);
$scope.currentPage = 1; // reset current page from the start
$scope.lastPage = parseInt(Math.ceil($scope.originalItems.length / $scope.pageSize.value)); // re-calculates the last page
$scope.items = $scope.originalItems.slice(begin, end);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment