In angular 5.2.x for http get and post I had this code:
post(url: string, model: any): Observable<boolean> {
return this.http.post(url, model)
.map(response => response)
.do(data => console.log(url + ': ' + JSON.stringify(data)))
.catch(err => this.handleError(err));
}
get(url: string): Observable<any> {
return this.http.get(url)
.map(response => response)
.do(data =>
console.log(url + ': ' + JSON.stringify(data))
)
.catch((error: any) => Observable.throw(this.handleError(error)));
}
In angular 6 it doesn't work.
How can we make an HTTP post or get request?
Update : In angular 7, they are the same as 6
In angular 6
the complete answer found in live example
it's because of
pipeable/lettable operators
which now angular is able to usetree-shakable
and remove unused imports and optimize the appsome rxjs functions are changed
more in MIGRATION
and Import paths
For JavaScript developers, the general rule is as follows:
rxjs: Creation methods, types, schedulers and utilities
rxjs/operators: All pipeable operators:
rxjs/webSocket: The web socket subject implementation
rxjs/ajax: The Rx ajax implementation
rxjs/testing: The testing utilities
and for backward compatability you can use
rxjs-compat