Hi,
Basically I am trying to handle the error messages globally for all http calls.Find the below snippet.
private handleError(error: Response) {
Rx.Observable.throw(new Error("error is generated"));
}
return this.sendRequest(new Request(options), headerArgs).map(res => res.json()).catch(this.handleError);
this.loginService.onLoginService(this.user).subscribe(
result => { console.log("executed succesfully";},
error => { console.error("failed to execute"+error);}
);
I should get the output as "failed to execute error is generated".But I am getting Observable is not defined in onLoginServiceMethod at error function.Pls let me know if anyone knows this
Need input on RxJS :Angular2
-
- Information
-
Who is online
Users browsing this forum: Baidu [Spider] and 9 guests