Created
May 26, 2014 01:04
-
-
Save Gwash3189/56c76772a2ae0bff9fb0 to your computer and use it in GitHub Desktop.
Pagination in JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPage(page, list, amountPerPage) { | |
if (page > 0) { | |
var start = 0; | |
if (page !== 1) { | |
start = page; | |
start = start -1; | |
} | |
if (list.length > 0) { | |
return angular.copy(list).splice((start * amountPerPage), amountPerPage); | |
} | |
} | |
return []; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment