Paldom / angular2-rest

Angular2 HTTP client to consume RESTful services. Built with TypeScript.
MIT License
248 stars 72 forks source link

How to handle ajax error? #8

Open ibufu opened 8 years ago

Discountrobot commented 8 years ago

please elaborate.

Since the rest client is simply returning a RxJS observable, you should read up on how the RxJS/subscribe method works.

You simply supply another callback like so:

  myMethod
  .subscribe(
    data => console.log(data),
    err => console.log(err),
    () => console.log('Completed')
  );
akarabach commented 7 years ago

add responseInterceptor. after use like this return response.catch (()=>{});