angular 2:找不到名称 'Response'
angular 2 : Cannot find name 'Response'
我在 angular 2 项目中遇到此错误:
Cannot find name 'Response'.
问题来自此服务:
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
@Injectable()
export class CartographyService {
public data;
constructor(private http: Http) {
}
getData() {
return this.http.get('http://localhost:8000/cartography')
.map((res: Response) => res.json());
}
}
在服务中添加这个
import { Http, Response } from '@angular/http';
我在 angular 2 项目中遇到此错误:
Cannot find name 'Response'.
问题来自此服务:
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
@Injectable()
export class CartographyService {
public data;
constructor(private http: Http) {
}
getData() {
return this.http.get('http://localhost:8000/cartography')
.map((res: Response) => res.json());
}
}
在服务中添加这个
import { Http, Response } from '@angular/http';