Do we need to unsubscribe from observable that completes/errors-out?

The Subscribing and Unsubscribing section of the Observable Contract is definitive regarding your question. It states: When an Observable issues an OnError or OnComplete notification to its observers, this ends the subscription. Observers do not need to issue an Unsubscribe notification to end subscriptions that are ended by the Observable in this way. This is … Read more

Observable Finally on Subscribe

The current “pipable” variant of this operator is called finalize() (since RxJS 6). The older and now deprecated “patch” operator was called finally() (until RxJS 5.5). I think finalize() operator is actually correct. You say: do that logic only when I subscribe, and after the stream has ended which is not a problem I think. … Read more

RxJs Array of Observable to Observable of Array

The flatMap operator allows to do that. I don’t fully understand what you try to do but I’ll try to provide an answer… If you want load all the getPostsPerUser() { return this.http.get(“https://stackoverflow.com/users”) .map(res => res.json()) .flatMap((result : Array<User>) => { return Observable.forkJoin( result.map((user : User) => user.getPosts()); }); } Observable.forkJoin allows you to wait … Read more