我正在尝试通过以下方式提交表单:
saveBuildcompany(): void {
// @ts-ignore
// @ts-ignore
console.log(this.group?.value);
let data2=this.group.value;
let serializedForm = JSON.stringify(data2);
console.log(data2);
// data2.sociallinks.stringify;
this.buildcompanyService.create(serializedForm)
.subscribe({
next: (res) => {
console.log(res);
this.submitted = true;
},
error: (e) => console.error(e)
});
}
服务如下:
create(data: any): Observable<any> {
let headers = new HttpHeaders();
headers.append('Content-Type', 'application/json');
headers.append('Accept', 'application/json');
return this.http.post(baseUrl+"/add", data, {headers: headers});
}
毕竟我得到了标题中的异常。我做错了什么?