Home > OS >  Pagination in angular
Pagination in angular

Time:03-01

I'm using ngx-pagination

https://www.npmjs.com/package/ngx-pagination

app.module:

import { NgxPaginationModule } from 'ngx-pagination';

@NgModule({
  declarations: [
    AppComponent,
   ...
  ],
  imports: [  
    ...
    NgxPaginationModule,
   
  ],

.ts file

  p: Number = 1;
  count: Number = 2;

Component:

 <li *ngFor="let data of this.lists; let i = index  | paginate: { itemsPerPage: count, currentPage: p }"><a href="javascript:void(0)"> # {{ i 1 }} Test</a></li>

Getting this error :

error NG5002: Parser Error: Unexpected token | at column 50 in [let data of this.lists; let i = index | paginate: { itemsPerPage: count, currentPage: p }] in ....component.html@67:32

Any solution to resolve this issue. Thanks

CodePudding user response:

Can you try this ?

<li *ngFor="let data of this.lists | paginate: { itemsPerPage: count, currentPage: p } index as i"><a href="javascript:void(0)"> # {{ i 1 }} Test</a></li>
  • Related