error-handling shows how to handle errors as follows:
private handleError (error: Response | any) { // In a real world app, we might use a remote logging infra
//First inject the router in the constructor private handleError (error: Response | any) { //Your other codes if (error.status == 0){ //or whatever condition you like to put this.router.navigate(['/error']); } }