How to unsubscribe from an Observable returned by forkJoin?
As forkJoin
reference says, it
Runs all observable sequences in parallel and collect their last elements.
This means that the operator gets values from completed observables and returns a completed observable with single value. There's no need to unsubscribe from it.
You can cancel it. Let's say observables
is an array of http requests you prepared to trigger (executed via httpClient
).
this.forkJoinSubscription = forkJoin(observables).subscribe(responses => {
. . . do something
});
this.forkJoinSubscription.unsubscribe();
You may notice in your network tab that those requests were cancelled.