我是angular 7的初学者。我正在使用angular 7来创建一些应用程序。在使用中,我导入了地图,但是没有用。我该如何解决?这是服务文件的代码。
SharedPreference
这是错误。http.get(...)。map不是函数
答案 0 :(得分:3)
您需要查看管道,因为您正在使用RxJS最新版本。
return this.http.get('http://jsonplaceholder.typicode.com/users')
.pipe(
map(res => res.json())
);
答案 1 :(得分:1)
android:scrollbarThumbVertical="@color/colorPrimaryDark"
将返回一个Observable。您无法对可观察对象执行this.http.get
。您需要map
到可观察对象,将结果转换为JSON,然后对其进行.subscribe
。
示例:
.map