Skip to content

Pagination with http Data #24

@sluisTW-zz

Description

@sluisTW-zz

Hi,

I'm using the component and it's working, except for the pagination.
Follow my component class:

import { DataTableResource } from "angular-4-data-table";
import { UserList } from "./../../models/userList";
import { Component, OnInit } from "";
import { UserService } from "../../services/user-service.services";

`

@component({
selector: "userList-cmp",
moduleId: module.id,
templateUrl: "userList.component.html",
providers: [UserService]
})

export class UserListComponent implements OnInit {
userList: Array = new Array();
itemResource: any;
userlistCount = 10;
`
constructor(private userService: UserService) {
console.log("construtor");

}

async ngOnInit() {
await this.getUsers();
}

private async getUsers() {
await this.userService.getUsers().subscribe(
res => {this.userList = res; this.itemResource = new DataTableResource(res); this.userlistCount = this.userList.length; }
);
}
}
`

HTML parameters:

<data-table [items]="userList" [itemCount]="userlistCount" [limit]="2">

Can you help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions