Following the angular 2 documentation and specifically https://angular.io/docs/ts/latest/guide/server-communication.html with code example in plunkr here - I was trying to simulate the error scenario for broken server link (so to call).
GET http://localhost:3002/heroes net::ERR_CONNECTION_REFUSED
scheduleTask @ zone.js:1990
ZoneDelegate.scheduleTask @ zone.js:384
onScheduleTask @ zone.js:274
However in the template html {{errorMessage}}
I'm getting 0 - {"isTrusted":true}
. How do I gather the error message net::ERR_CONNECTION_REFUSED
?
Note that one need to add import 'rxjs/add/observable/throw';
to the service so as to avoid the error - TypeError: Observable_1.Observable.throw is not a function
which would otherwise be encountered.