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:-
hope helps
Comments
Post a Comment