Reputation: 1
I am iterating *ngFor loop but when I click the next to the pagination then again index number starts from 0. Please provide the solution If anybody have any idea. I am using ngb-pagination.
<table class="table records-content-table " role="grid">
<thead>
<tr role="row">
<th>Name</th>
</tr>
</thead>
<tbody>
<ng-container
formArrayName="broadcastAppointment" *ngFor="let appointment of filteredAppointmentsList | slice: (page-1) * ngPageSize : (page-1) * ngPageSize + ngPageSize; let i=index; trackBy:trackByAppointmentId">
<tr class="table-tr-hover">
<td (click)="fetchAppointmentMessages(appointment, i, $event, 'row')"
(change)="countSelectedApptId(i, $event)" class="textEclipse" title="{{appointment.clientName}}">
<span class="multiselectAppointmentDiv ml-1 mr-1" *ngIf="allowApptToBroadcast">
<input id="selectAppt-{{i}}" name="name"
(click)="fetchAppointmentMessages( appointment, i, $event)"
class="broadcastChkBox apptListChkBox" type="checkbox" [formControlName]="i">
<label for="selectAppt-{{i}}" class=" control-label"></label>
</span>
</td>
</tr>
</ng-container>
</tbody>
</table>
Upvotes: 0
Views: 353