Asp.net core 2.1 Web Api + Angular6 分页 (ngx-bootstrap)

顾俊楚
2023-12-01

1.安装X.PagedList

GitHub 地址:https://github.com/dncuug/X.PagedList

.NET Core (.NET Standard 2.0)

  1. Install X.PagedList.Mvc.Core via NuGet - that will automatically install X.PagedList as well.

方法应该是:dotnet add package X.PagedList.Mvc.Core --version 7.5.0

 

安装完之后,在你项目中引用

using X.PagedList;

ok,按照 GitHub那个就OK了, 一个 to paged list()就差不多了

前台的 angular那边就往后传第几页就行了,pageIndex

<pagination [totalItems]="totalElments" (pageChanged)="pageChanged($event)"></pagination>

  getAllGarbages(pageIndex: number) {    
    this.garbageServices.getAllGarbages(pageIndex).subscribe((result: any) => {
      this.garbageList = result.garbageViewModels;
      this.noRecord = result.totalElements === 0;
      this.totalElments = result.totalElements;

大概就这样啊。 嘿嘿

 类似资料: