我在Angular 2项目中遇到了此错误:
找不到名称"响应"。
问题来自此服务:
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';