Issue
public rows$: Observable<any[]> = combineLatest([
this.items$,
this.term$,
]).pipe(
map(([items, term]) =>
items.filter(
(item) =>
term === "" ||
item.product_name === term ||
item.product_detail === term
If we think in database logic, it can be interpreted as the use of like expression. Ex. Contains includes
Solution
You can use Object.values.includes
to search for a value in an object like this
public rows$: Observable<any[]> = combineLatest([
this.items$,
this.term$,
]).pipe(
map(([items, term]) => items.filter((item) => Object.values(item).includes(term)))
Answered By - Yousaf Raza
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.