I have a function that selects an offer, but I need to check whether this offer is in the Observable array of offers$ first.
selectOffer(offer) {
this.offers$.subscribe(items => {
items.forEach(item => {
if (item === offer) {
// if offer is in offers$, DO...
}
});
});
}
How could I transform this to work with Rxjs operators (pipe, map, filter etc..)
true/false
based on whether the item is in the array? – martinselectOffer
to return? What kind of observable isthis.offer$
. – Poul Kruijt