I have multiple paginations with ng-for
. For multiple instances, I'm using the variable from ng-for
to repeat paginations, but (pagechange) event is mutating data. when I change page in child pagination, it is changing data(first_name). I have a reproduced issue stackBlitz
I have also tried with index, but its disturbing main pagination.
<ul>
<div *ngFor="let item of collection | paginate: {itemsPerPage:3, currentPage: page,id: mainPagination}; let i = index;">
<div class="user">
{{ i + 1 }}. {{ item.first_name }}
<!-- <br>Child Pagination -->
<div class="childPagination" *ngFor="let address of item.address | paginate: {itemsPerPage:3, currentPage: item['first_name'],id: item['first_name']}" style="background-color:#18bc9c">
{{ address.friend }}
</div>
<pagination-controls (pageChange)="item['first_name']= $event" [id]= "item['first_name']" class="my-pagination"></pagination-controls>
</div>
</div>
</ul>
<pagination-controls (pageChange)="page = $event" [id]= "mainPagination" class="my-pagination"></pagination-controls>