Property 'map' does not exist on type 'Observable' while upgrade to Angular 6/7/8/9 from Angular 5/4/2
Error - Property 'map' does not exist on type 'Observable<Response>'
Thanks!!!
Root Cause - When you upgrade your application from Angular 2/4/5 to Angular 6/7/8/9 then there are some functions that can not support in major versions.
Solution - To get rid of this error change your import statements as below.
import { Observable } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
And change your implementation for map function as below using 'Pipe' function.
delete(url: string, options?: any): Observable<any> {
return this._http.delete(`${this._baseUrl}${url}`, options)
.pipe(
map(result => {
return result;
}),
catchError((e: any) => Observable.throw(this.errorHandler(e)))
);
}
Thanks!!!
Comments
Post a Comment