Issue with multiple paginators in loop
See original GitHub issueHi,
Thanks for the awesome component. It is really helpful.
I am facing issue in creating multiple paginators on single page. When I click the next button, it changes the page number for all instances. As per documentation, I am using unique id for each instance but facing same issue.
Please find below code snippet.
Here I am dynamically creating tables based based on “nodeName” received in first ngFor loop and then displaying data in each table (div) in each table in second ngFor loop. It displays the pagination for each table but on click of next button it moves to next page for all tables

I
<div style="display:inline-block;width:50%; padding-top:20px " *ngFor="let data of tabularData">
<div class="">
<div class="row dataFormatter">
<div class="col-12 tabDataPadding dataheader">{{data.nodeName}}</div>
</div>
<div class="row table-bordered dataFormatter">
<div class="col-4 tableBody tabDataPadding">Items</div>
<div class="col-3 tableBody tabDataPadding">Value</div>
<div class="col-5 tableBody tabDataPadding">Updated On</div>
</div>
<div class="row table-bordered dataFormatter" *ngFor="let tb of data.attributes | paginate: {id: data.nodeName, itemsPerPage:5 , currentPage:p }">
<div class="col-4 tableBody tabDataPadding">{{tb.key}}</div>
<div class="col-3 tableBody tabDataPadding">{{tb.value}}</div>
<div style="font-size:0.9em" class="col-5 tabDataPadding tableBody">{{tb.date}}</div>
</div>
<pagination-controls id={{data.nodeName}} (pageChange)="p = $event"></pagination-controls>
</div>
</div>
=======
Angular version: 5.1.1
ngx-pagination version: 3.1
Description of issue:
Steps to reproduce:
Expected result:
Actual result:
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Pagination problem with multiple loops on the same page
Is there a way to page the pagination aware of what the loop is and only scroll through that loop? Thanks in advance!...
Read more >Wordpress: Multiple Custom Loop in One Page with Pagination
The answer from the following link allow you to have as many custom loops as you want all in the same page! https://wordpress.stackexchange.com/ ......
Read more >Pagination Problem With Multiple Activity Loops on Same Page
I've created an aggregation page with two loops, each showing content from different types of users. The problem is that if I click...
Read more >Multiple pagination on the same page - Laravel tips, tricks and ...
Multiple pagination on the same page - Laravel tips, tricks and packages · Comments • 18.
Read more >Multiple channel loops without breaking pagination?
I want to break the loop into 2 sections in order to show an advertisement every 5 entries. So right now I have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for the link. I see the problem now.
You have only a single, shared variable
prepresenting the current page. Each instance of pagination is therefore updating this shared variable, which then affects all other instances.The solution is to use a unique currentPage variable for each instance. One way to do it is like this:
See this updated demo.
Thanks Micheal. I will check it out.