Skip to content

Instantly share code, notes, and snippets.

@pichfl
Created September 22, 2014 10:35
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 pichfl/83c5525676174b12a2b2 to your computer and use it in GitHub Desktop.
Save pichfl/83c5525676174b12a2b2 to your computer and use it in GitHub Desktop.
paginationPages: computed('page', 'totalPages', function() {
var page = this.get('page');
var totalPages = this.get('totalPages');
var pages = [];
var i = Math.max(0, page - pagesRange);
var max = Math.min(totalPages, page + pagesRange);
for (i; i < max; i++) {
pages.push(i+1);
}
return pages;
}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment