【发布时间】:2017-10-21 16:10:59
【问题描述】:
我正在尝试按照教程步骤 7 HTTP (https://angular.io/tutorial/toh-pt6) 学习 Angular 2。但是 hero.service.ts 中的函数 getHeroes() 仍然没有返回任何内容。
getHeroes(): Promise<Hero[]> {
return this.http.get(this.heroesUrl)
.toPromise()
.then(response => response.json().data as Hero[])
.catch(this.handleError);
}
模拟服务是从InMemoryDbService 实现的。
有什么想法吗?
【问题讨论】: