找不到模块:错误:无法解析'C:\ MAMP \ htdocs \ AngularFrontEnd \ src \ app'中的'rxjs / Rx'

时间:2018-06-03 16:14:30

标签: angular

我最近开始修改Angular并观看视频,但在尝试按照某个教程时,我遇到了这个错误"Module not found: Error: Can't resolve 'rxjs/Rx' in 'C:\MAMP\htdocs\AngularFrontEnd\src\app'"。错误发生在此文件中:

quote.service.ts:

import { Injectable } from "@angular/core";
import { Http, Response } from "@angular/http";
import 'rxjs/Rx';
import { Observable } from "rxjs";

@Injectable()
export class QuoteService {
    constructor(private http: Http){

    }
    getQuotes() {
        return this.http.get('http://onyx.space/api/quotes')
        .map(
            (response: Response) => {
                return response.json().quotes;
            }
        );
    }
}

可悲的是,由于我是新手,我不确定要采取哪些故障排除步骤。

1 个答案:

答案 0 :(得分:1)

只需删除import 'rxjs/Rx';,然后尝试从angular documentation了解有关rxjs的更多信息