继2角度的文档,具体https://angular.io/docs/ts/latest/guide/server-communication.html与代码示例在普朗克here - 我试图模拟错误情况破碎的服务器链接(这样调用)。显示错误的类型net :: ERR_CONNECTION_REFUSED
GET http://localhost:3002/heroes net::ERR_CONNECTION_REFUSED
scheduleTask @ zone.js:1990
ZoneDelegate.scheduleTask @ zone.js:384
onScheduleTask @ zone.js:274
然而,在模板HTML {{errorMessage}}
我越来越0 - {"isTrusted":true}
。如何收集错误信息net::ERR_CONNECTION_REFUSED
?
请注意,需要将import 'rxjs/add/observable/throw';
添加到该服务,以避免出现否则会遇到的错误 - TypeError: Observable_1.Observable.throw is not a function
。