I\'m new to angular and trying to implement pagination in my app. I am trying to use this material component.
With the code below, I can get length,
Another way to link Angular Paginator with the data table using Slice Pipe.Here data is fetched only once from server.
View:
//actual data dispaly
Component
pageIndex:number = 0;
pageSize:number = 50;
lowValue:number = 0;
highValue:number = 50;
getPaginatorData(event){
console.log(event);
if(event.pageIndex === this.pageIndex + 1){
this.lowValue = this.lowValue + this.pageSize;
this.highValue = this.highValue + this.pageSize;
}
else if(event.pageIndex === this.pageIndex - 1){
this.lowValue = this.lowValue - this.pageSize;
this.highValue = this.highValue - this.pageSize;
}
this.pageIndex = event.pageIndex;
}