Reputation: 723
The following code has got compiling errors saying the return of concat
cannot be assigned to an Observable
. So how can I achieve the following?
let o1$: Observable<Object[]> = this.apiService.get();
let o2$: Observable<Object> = of({ a: "b" });
let o1$ = concat(o1$, o2$);
Plus how can I remove an Object
from o1$
?
Upvotes: 0
Views: 1371
Reputation: 7746
Observables don't work that way. They aren't synchronous, so operations like remove or push to/from an observable don't work since you don't have the full data-set available to you. It's more/less a stream.
Instead, you filter, skip, take n, or any other filtering operation, the stream:
o1$.filter(o => isGood(o));
Or combine, forkJoin, combineLatest, etc., multiple streams:
merge(a$, b$)
I hope this helps!
Upvotes: 2