Posts

Showing posts with the label angular-material2

Pagination in angular material from data fetched from an api

Pagination in angular material from data fetched from an api I get a list of 100+ users fetched from an api. Now I would like to implement that data in the angular material table. Is it possible in the frontend that i display only 10 users in pageSize and have pagination. I tried but it displays all available users eventhough I have pagination module implemented. <mat-paginator [pageSize]="10" showFirstLastButtons></mat-paginator> In the typescript code, i get the list from the parent component. import {Component, OnInit, ViewChild, Input, OnChanges} from '@angular/core'; import {MatPaginator, MatTableDataSource} from '@angular/material'; @Component({ selector: 'app-users', templateUrl: './users.component.html', styleUrls: ['./users.component.scss'] }) export class UsersComponent implements OnInit, OnChanges { @Input() users; displayedColumns = ['name', 'id']; dataSource; @ViewChild(MatPaginator...