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

前端 未结 19 2478
时光取名叫无心
时光取名叫无心 2020-11-22 03:36

I have a problem with HTTP in Angular.

I just want to GET a JSON list and show it in the view.

Service class

im         


        
19条回答
  •  长发绾君心
    2020-11-22 04:18

    this is happening because you are using the rxjs and in rxjs function are not static which means you can't call them directly you have to call the methods inside the pipe and import that function from the rxjs library

    But if you are using rxjs-compat then you just need to import the rxjs-compat operators

提交回复
热议问题