TypeError: Converting circular structure to JSON when trying to POST request

前端 未结 6 1102
星月不相逢
星月不相逢 2021-02-12 15:34

I am getting the error in the title and here is the full stack trace, i am not sure what it is, any insight is welcomed!

browser_adapter.js:84 EXCEPTION: Error i         


        
6条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-12 16:25

    In Addition to already provided answers, here is what you can do when you intend to post the entire form values.

    Form example:

    ...

    In ts:

    submit(formData: any) {
        const data = JSON.stringify(formData.value);
        this.myService.postData(data)...
    }
    

    You are getting the values of the entire form from formData.value then stringify using JSON.stringify(obj)

    I hope this will help someone.

提交回复
热议问题