Need input on RxJS :Angular2

UI Components for Angular
Post Reply
SankarReddy
Posts: 17
Joined: 15 Mar 2016, 08:02

29 Mar 2016, 12:41

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

mcwebdev
Posts: 68
Joined: 03 Mar 2016, 02:16

29 Mar 2016, 18:55

Are you getting any 404's in network panel? Observable is undefined sounds like the library is not loaded.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests