Home:ALL Converter>display errors of the type net::ERR_CONNECTION_REFUSED

display errors of the type net::ERR_CONNECTION_REFUSED

Ask Time:2017-04-17T17:39:09         Author:user3206440

Json Formatter

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.

Author:user3206440,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/43448927/display-errors-of-the-type-neterr-connection-refused
yy