I want to be able to filter products based on one of a, b, c, or d matching the value of `this.listFilter'
I think the code below is almost doing what I want, the split function returns an array but only seems to be matching on the first element in the array, I need to iterate over each element and check if it matches the value of this.listFilter
.
The breadcrumb array contains:
breadcrumb[
'a > b > c > d'
]
return this.products.filter((product: IProduct) => product.categories.category.breadcrumb[0].split(' > ').indexOf(this.listFilter));
Can anyone suggest a way to iterate over the array split by the " > " and check against the value of this.listFilter
?