Reputation: 53
Is it posible to know when the MatPaginator has finish loading the page?
when loading a page with 500 items my browser freeze for few seconds, so i'd like to show loading... until the page is fully loaded handlePage($event) only fires when paging
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100,500]" showFirstLastButtons (page)="handlePage($event)"
Thanks!
Upvotes: 0
Views: 704
Reputation: 5176
You can use mat-spinner
for that along with some basic logic.
<div *ngIf="isLoading">
<mat-progress-spinner color="primary" mode="indeterminate"></mat-progress-spinner>
</div>
and then in your ts file where your data is being fetched you can use:
isLoading = true;
this.yourService.getTableData().subscribe(data => {
this.dataSource = data
this.isLoading = false;
},
error => this.isLoading = false
);
Upvotes: 1