带有TypeScript错误http.get(…).map的角度HTTP GET不是[null]中的函数
我在Angular中遇到HTTP问题。 我只想 GET 一个 JSON 列表并将其显示在视图中。 服务等级 import {Injectable} from "angular2/core"; import {Hall} from "./hall"; import {Http} from "angular2/http"; @Injectable() export class HallService { public http:Http; public static PATH:string = 'app/backend/' constructor(http:Http) { this.http=http; } getHalls() { return this.http.get(HallService.PATH + 'hall.json').map((res:Response) => res.json()); } } 在 HallListComponent 我从服务中调用 getHalls 方法: export class HallListComponent implements OnInit { public halls:Hall[]; public _selectedId:number; constructor(private _router:Router, private