Skip to content

Instantly share code, notes, and snippets.

@brachi-wernick
Created January 14, 2018 13:18
Show Gist options
  • Save brachi-wernick/83a69f55ba92b36352800ed23fdd9e2a to your computer and use it in GitHub Desktop.
Save brachi-wernick/83a69f55ba92b36352800ed23fdd9e2a to your computer and use it in GitHub Desktop.
send callback on http error
public deleteItem(id: number, callback?: any): Observable<{}> {
//some prepartion of the http request...
return this.http.request(path, requestOptions)
.map((response: Response) => {
//some stuff...
}).catch((error: any) => {
error.callback=callback;
return Observable.throw(error);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment