Reputation: 2841
just startting to upgrade angular 2.0.0 to 5.2.0 . So i'm using HttpClient .
I want to use timeoutWith operator on httpClient.get()
. All i get is Property 'timeoutWith' does not exist on type 'Observable<Object>'.
someFunction(){
let someUrl = '.../../' ;
return this._httpClient.get(url).timeoutWith(1000,this.throwTimeout()).catch(this.handleError);
}
What am i doing wrong ? this was working with the previous httpmodule
Thanks
Upvotes: 0
Views: 1155
Reputation: 3211
For better performance, You should import you observable operators individually. It's goes with the guide lines of angular and their AOT compile. Splitting your imports help's the compiler to do tree shaking.
So, as other already wrote, You need to add timeoutWith operator
import 'rxjs/add/operator/timeoutWith';
And any other operator you need to use.
Upvotes: 1
Reputation: 1710
A lot of properties doesn't exist anymore on type Observable, now.
You need to import that from rxjs.
import 'rxjs/add/operator/timeoutWith';
You should probably import other properties like map
import 'rxjs/add/operator/map'
This link could help you to migrate from Angular 2 to Angular 5.
Upvotes: 1