Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. export class PaginatorConfigurableExample {
  2. length = 100;
  3. pageSize = 5;
  4. pageSizeOptions: number[] = [5, 10, 25, 100];
  5. cardsList = ['card 1', 'card 2','card 3', 'card 4','card 5', 'card 6','card 7', 'card 8','card 9', 'card 10','card 1', 'card 2','card 1', 'card 2','card 1', 'card 2','card 1', 'card 2','card 1', 'card 2'];
  6.  
  7. filterdCards = this.cardsList.slice(0,this.pageSize);
  8. pageEvent: PageEvent;
  9. updateCards(e){
  10. console.log(e);
  11. this.filterdCards = this.cardsList.slice( e.pageIndex * e.pageSize, (e.pageIndex +1) * e.pageSize);
  12. console.log(this.filterdCards);
  13. }
  14. }
  15.  
  16.  
  17.  
  18.  
  19. <mat-card *ngFor="let card of filterdCards">{{card}}</mat-card>
  20.  
  21. <mat-paginator [length]="cardsList.length"
  22. [pageSize]="pageSize"
  23. [pageSizeOptions]="pageSizeOptions"
  24. (page)="pageEvent = updateCards($event)">
  25. </mat-paginator>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement