angular - How to get first objects of an Observable -
i have observable contains list of users, , want take part of it, handle pagination. how can that? i've tried filter doesn't workk :
this.users.filter(function (x: any, idx: number) { return idx < 3; });
just use array slice inside of map operator. depending on page , page size can set so:
const pageindex = 0; const pagesize = 3; this.users.map((users: user[]) => { return users.slice(pageindex, pagesize); });
Comments
Post a Comment