I want to work with switchMap for my http request instead of unsubscribing my pending requests.
I am getting following info for the code below:
The 'this' context of type 'void' is not assignable to method's 'this' of type 'Observable<{}>'
sub = new BehaviorSubject({});
let result: Observable<any> = this.sub.next(this.urlShortenerForm.value);
const result: Observable<Object> = this.sub.pipe(
switchMap((term) => this.getData(term));
);
getData(da): Observable<Object> {
//Here I will send my request to server over services
return of(da);
}