Skip to content

Instantly share code, notes, and snippets.

@epappas
Created October 9, 2014 14:21
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 epappas/e8ab580d932aff17f62d to your computer and use it in GitHub Desktop.
Save epappas/e8ab580d932aff17f62d to your computer and use it in GitHub Desktop.
Angular Pagination + Jade
ul.pagination.right()
// if current page is > 10, have -10 back btn
li.arrow(ng-if="currentPage > 10")
a(ng-click='goToPage(currentPage - 10)') ««
// have previous & nect page as clicable option
li(ng-repeat='n in [-1, 0, 1]' ng-class="{current: currentPage == currentPage + n}")
a(ng-if="currentPage + n > 0 && (currentPage + n) < (total / 10)",
ng-click='goToPage(currentPage + n)') {{currentPage + n}}
// Next btn, if next exists
li.arrow(ng-if="currentPage < (total / 10) + 3 && (currentPage + 3) < (total / 10)")
a(ng-click='goToPage(currentPage + 3)') »
// if There is more to go, have a +10 btn option
li.arrow(ng-if="currentPage < ((total / 10) - 10)")
a(ng-click='goToPage(currentPage + 10)') »»
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment