Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularHTTP post在向json添加用户数据后添加多个空对象_Angular_Http Post_Httpclient - Fatal编程技术网

AngularHTTP post在向json添加用户数据后添加多个空对象

AngularHTTP post在向json添加用户数据后添加多个空对象,angular,http-post,httpclient,Angular,Http Post,Httpclient,.ts: .服务: addProduct(productForm:NgForm) { return this.httpObj.post<products>(`${this.uri}/products`,productForm,{ headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }); addPro

.ts:

.服务:

addProduct(productForm:NgForm) {

        return this.httpObj.post<products>(`${this.uri}/products`,productForm,{
            headers: new HttpHeaders({
                'Content-Type': 'application/json'
            })
    });
addProduct(productForm:NgForm){
返回此.httpObj.post(`${this.uri}/products`,productForm{
标题:新的HttpHeaders({
“内容类型”:“应用程序/json”
})
});
当我输入表单数据并提交时,最后输入的数据将被覆盖并输入新数据。在输入新数据后,将插入多个空行。可能会出现什么问题

addProduct(productForm:NgForm){
    this.productService.addProduct(productForm.value).subscribe((res:any)=>
        res= **this.addProduct(res)**
    );  
}
您有一个不需要的递归正在进行


您有一个不需要的递归正在进行。

hmm,可能是后端问题吗?进入网络选项卡,并截取您发送到服务器的有效负载的屏幕截图。让我们看看它。我已经添加了pls checkhmm,可能是后端问题吗?进入网络选项卡,截取您发送到服务器的有效负载的屏幕截图。让我们来看看看一看,我已经添加了请检查谢谢你。发现有帮助谢谢你。发现有帮助
addProduct(productForm:NgForm){
    this.productService.addProduct(productForm.value).subscribe((res:any)=>
        res= **this.addProduct(res)**
    );  
}