TypeError: error.json is not a function

前端 未结 5 1632
陌清茗
陌清茗 2021-01-04 20:37

Edit: Read the part at the end of the question!

I get this error:

My service code:

import { Http, Response, Headers } from \         


        
5条回答
  •  孤城傲影
    2021-01-04 21:32

    Well, like it states. The error returned from the observable does not contain the json method. This means that it is not of the type Response, but it just contains the error. You should just try to print out the object in your console and see what's in there:

    .catch((error: any) => console.log(error))
    

    You will probably find it's just an xmlhttpresponse object

提交回复
热议问题