I'm new at angular so I have this issue.
<div class="col-md-4" *ngFor="let student of students | paginate: {itemsPerPage:5, currentPage: p, totalItems: len}">
{{student.name}}
</div>
<pagination-controls (pageChange)="p =$event"></pagination-controls>
I'm getting this error
Cannot read property 'totalItems' of undefined at PaginatePipe.push../node_modules/ngx-pagination/dist/ngx-pagination.js.PaginatePipe.transform
Component code:
public students= [];
public len;
ngOnInit() {
this.serverService.getStudents().subscribe(
data => {
this.students= data,
this.len = this.students.length
}
);
}