michaelbromley / angularUtils

A place where I will collect useful re-usable Angular components that I make

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I obtain the current index, and how can I set an existing page in specific?

YeisonVelez11 opened this issue · comments

How can I obtain the current index, and how can I set an existing page in specific?

for example:

|1 | |2 | | 3| ....|9|

The current page is the 2.

How can get the pagination "2".
and How can set the page "3" for example?

thanks

you'll need to adapt this to your use case but here is an example that I use to get the current index|page

<li dir-paginate="event in tpl.events | itemsPerPage:tpl.pagination.perPage" current-page="tpl.pagination.currentPage" class="event">

then in your controller this.pagination.currentPage would be the index|page. You can set page to 3 by setting this.pagination.currentPage to equal 3.