Angular 5中的服务器端分页

时间:2018-05-03 04:27:20

标签: angular pagination server-side

我需要实现来自api的服务器端分页我得到页码和页面限制,我需要在表格下方显示一系列按钮,点击该按钮api调用将发生相应的按钮编号。假设我点击按钮编号2然后我需要在表格中显示第2页数据。为此我使用角度5.我尝试了ngx-pagination但它对我不起作用。我的json是这样的:

[
  {
    "pagecount": [
      {
        "record_count": "69",
        "pagenumber": "0",
        "pagelimit": "5"
      }
    ]
  },
  {
    "completed": [
      {
        "queueid": "297885",
        "cust_name": "MR DEWESH SHANKER",
        "veh_number": "KA03 MW7878",
        "payment_status": "Paid",
        "queue_total": "7104",
        "rating": "5.0"
      },
      {
        "queueid": "298162",
        "cust_name": "Pratham Motors Stockyard",
        "veh_number": "CH14 0527",
        "payment_status": "Paid",
        "queue_total": "0",
        "rating": "5.0"
      },
      {
        "queueid": "298163",
        "cust_name": "MS PALLAVI R DHOTRAGAVI\t",
        "veh_number": "KA51 MK4228",
        "payment_status": "Paid",
        "queue_total": "2131",
        "rating": "5.0"
      },
      {
        "queueid": "298196",
        "cust_name": "Pratham Motors Stockyard",
        "veh_number": "CH15 9983",
        "payment_status": "Paid",
        "queue_total": "0",
        "rating": "5.0"
      }
    ]
  }
]

我怎样才能做到这一点。有人请吗?

2 个答案:

答案 0 :(得分:0)

Angular有很多可用的分页组件,其中一些是我使用的 -

您可以使用

也取决于您的要求。

答案 1 :(得分:-1)

您是否尝试过角度数据表?配置类似于经典数据表。看起来很有希望。 https://l-lin.github.io/angular-datatables/#/getting-started