I currently have an array of observables which I'm iterating over using an *ngFor
loop with the async pipe.
I would like to filter the observables by a property value on the object, e.g
Original array:
[{ name: test1,
type: type1},
{ name: test2,
type: type2}
{ name: test3,
type: type1}
{ name: test4,
type: type2}]
I would like to filter this and make two new observable (arrays), one for type1 and one for type2
I tried obs.filter(x => x.type == "type1)
but it returns nothing
I then tried obs.mergeAll().filter(x => x.type == "type1")
and I can subscribe to this and log it to the console correctly but now it doesn't work with my *ngFor
(async pipe). I'm guessing it's because the mergeAll
means it's no longer an observable array? So do I need to convert it back?