Issue
I am using rxjs
for filter and find the include value. but getting an error as TypeError: value.includes is not a function
any one correct me please?
here is my function:
fetchPaginatedList(pageSize, searchTerm) {
return this.list$
.pipe(
map((list) =>
list.filter((item) =>
Object.values(item).some((value) =>
value.includes(searchTerm)
)
)
),
map((list) => ({
size: list.length.toString(),
list: list.splice(0, pageSize),
}))
)
.toPromise();
}
what is the correct way to integrate the include
with rxjs filter?
Solution
it should work:
fetchPaginatedList(pageSize, searchTerm) {
return this.list$
.pipe(
map((list) =>
list.filter((item) =>
Object.values(item).some((value) =>
value?.includes(searchTerm)
)
)
),
map((list) => ({
size: list.length.toString(),
list: list.splice(0, pageSize),
}))
)
.toPromise();
}
Answered By - user2024080
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.