I\'m upgrading to Angular to version 5, I was using @angular/http
before and now I need to update to @angular/common/http
and use HttpClient
I a
You can create your own Observable that wraps the http.get and return your manipulated response, in this example it is the manipulatedAccountsResponse object:
getAll(): Observable {
return Observable.create(observer => {
this.http.get('/accounts')
.subscribe((result) => {
const manipulatedAccountsResponse = result;
// do something with result.
manipulatedAccountsResponse.setTotal(100);
observer.next(manipulatedAccountsResponse);
// call complete if you want to close this stream (like a promise)
observer.complete();
});
});
}