Error: Property 'map' does not exist on type 'Observable'

人盡茶涼 提交于 2019-12-02 12:23:51

Its easy to post an answer when you provide your code instead of a screenshot. Anyhow, you have to pipe it:

getUsers() {
    return this._http.get(this.baseUrl+'/show-users', this.options)
                     .pipe(
                          map((response:Response)=>response.json())
                      );

Remember to import map like this:

import { map } from 'rxjs/operators';

For the latest Version of rxjs we need to install npm install rxjs-compat from terminal then declare

import 'rxjs/add/operator/map';

You can find a solution by using pipe. Here are the steps...

First import map

import {map} from 'rxjs/operators';

Modify your getuser() and other all functions by using pipe

getUser(){
 this._http.get(this.baseUrl+'/show-users', this.options).pipe(map((response:Response)=>response.json()));                
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!