I am wondering if I have to unsubscribe my subscription in the following case. I create an observable using combineLatest
of the two angular observables route.params
and route.queryParams
.
To use them as parameters within an http request I call switchMap
and return the http request's observable.
Then I describe to this observable.
Now I am wondering if I have to take care of the subscription. Usually I do not since the observable returned by angular's http service completes after first value emit.
In my current case I am not sure since the original observable was created by calling combineLatest
.
// Somewhere within my component.
const subscription = combineLatest(this.route.params, this.route.queryParams).pipe(
switchMap(([params, queryParams]: [Params, Params]) => this.http.get<number>(`query/path/${params.id}/${queryParams.type}`)
).subscribe(data => console.log(data));