javascript - Pagination in IONIC 2 -


thanks help!. in oportunity, need create pagination grid (like google pagination or that) , show 10 or 20 rows in current page. can't find ionic 2, pagination infinite scroll.

thanks again!

what need have subject can act both publisher , subscriber.

  • create service can pages simple http calls.
  • use subject can used both publisher , subscriber.
  • use *ngfor async pipe.
  • publish using subject using next() method , have *ngfor listen observable.

    sample code:-

//subject can used publisher , subscriber

private paginationgetter: subject <product[]> = new subject <product[]> (); private paginationgetter$: observable <product[]> = this.paginationgetter.asobservable(); 

return paginationgetter$ in method returns pages , use paginationgetter.next(data) publish new data , display using code similar to:-

ion-col *ngfor="let item of items | async"> 

note items refer to: paginationgetter$ , async pipe necessary *ngfor able display observables.

please, refer live example here:-

pagination example

hope helps


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -