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

前端 未结 3 1251
伪装坚强ぢ
伪装坚强ぢ 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 13:15

    The 'O' character in 'rxjs/Observable' must be Upper Case.

    Specifying it in lower case 'o', will give you this and other spooky errors. This must be imported like this:

    import { Observable } from 'rxjs/Observable';
    import 'rxjs/add/operator/catch';
    import 'rxjs/add/observable/throw';
    

    It took me an hour to find it. When using import, generally, the names are in lower case. This is the first time I'm seeing this. I hope it will help the others :)

提交回复
热议问题