Angular2 Http with RXJS Observable TypeError: this.http.get(…).map(…).catch is not a function

前端 未结 3 1254
伪装坚强ぢ
伪装坚强ぢ 2021-02-19 12:28

I have following Service which was working fine until today i got this error

TypeError: this.http.g         


        
3条回答
  •  甜味超标
    2021-02-19 12:57

    It seems that the catch operator isn't imported.

    You could try to import it like this:

    import 'rxjs/add/operator/catch'
    

    Or more generally this if you want to have more methods for observables:

    import 'rxjs/Rx';
    

    See this question:

    • Angular 2 HTTP GET with TypeScript error http.get(...).map is not a function in [null]

提交回复
热议问题