I'm reading an article about the rxjs concatMap
operator. This guy builds an autosave form, i.e., whenever the user types a letter the data is saved using a http request
this.subscription = this.form.valueChanges
.pipe(concatMap(formValue => this.http.put(`/api/course/${courseId}`, formValue)))
.subscribe(saveResult => ... handle successful save ...);
I want to be able to unsubscribe in ngOnDestroy()
from the valueChanges
Observable, but the this.subscription
Subscription refers to the http
observable. So how can I unsubscribe from valueChanges
?