I am using angular 11 and trying to implement pagination
HTML
<tbody>
<tr *ngFor="let order of orders | paginate: config;let i = index">
<th scope="row" style="display:none;">{{ i + 1 }}</th>
<td>{{ order.Code }}</td>
<td>{{ order.quantity }}</td>
</tr>
</tbody>
</table>
<pagination-controls id="basicPaginate" (pageChange)="pageChanged($event)"></pagination-controls>
app.module.ts
.....
import { NgxPaginationModule } from 'ngx-pagination';
imports: [
.......
RouterModule.forRoot(AppRoutes,{
useHash: true
}),
.......
NgxPaginationModule
]
Orders component
export class OrderComponent implements OnInit {
orders : Order [] = [];
config:any;
constructor(private orderService : OrderService {
this.config = {
id: 'basicPaginate',
itemsPerPage: 5,
currentPage: 1,
totalItems: 50
};
}
ngOnInit(){
//web service ok
this.orderService.getAllOrders(30,5,0).pipe(first()).subscribe(orders => this.orders = orders);
}
pageChanged(event) {
this.config.currentPage = event;
}
}
The project compiles ok
So why is this error occuring ? I want only the basic pagination and not the custom one. Is there a compatibility issue with Angular 11 ?