Data table with pagination
We have created the scaffolding to lay out our master/detail view. In the master outlet, we will have a paginated data table of users, so let's implement UserTableComponent
, which will contain a MatTableDataSource
property named dataSource
. We will need to be able to fetch user data in bulk using standard pagination controls such as pageSize
and pagesToSkip
and be able to further narrow down the selection with user-provided searchText
.
Let's start by adding the necessary functionality to the UserService
:
- Implement a new
IUsers
interface to describe the data structure of the paginated data:src/app/user/user/user.service.ts ... export interface IUsers { data: IUser[] total: number }
- Update the interface for
UserService
with agetUsers
function:src/app/user/user/user.service.ts ... export interface IUserService { getUser(id: string): Observable<IUser> updateUser(id: string, user: IUser)...