【发布时间】:2018-06-22 07:19:18
【问题描述】:
这是我在 Angular 6 中的第一个项目。我想在我的项目中使用 chart.js。我安装了chart.js并点击链接https://coursetro.com/posts/code/126/Let's-build-an-Angular-5-Chart.js-App---Tutorial
但我的 service.ts 文件出现错误。它抛出错误“[ts] Property 'map' does not exist on type 'Observable'。”
我的服务代码是
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import 'rxjs/add/operator/map';
@Injectable({
providedIn: 'root'
})
export class DragchartService {
constructor(private _http: HttpClient) { }
dailyForecast() {
return this._http.get("http://samples.openweathermap.org/data/2.5/history/city?q=Warren,OH&appid=b6907d289e10d714a6e88b30761fae22")
.map(result => result);
}
}
所以我请求您帮助我解决这个问题。谢谢。
【问题讨论】:
-
你好像用的是RxJS6,需要用管道github.com/ReactiveX/rxjs/blob/master/docs_app/content/guide/v6/…
标签: javascript object rxjs observable angular6