如何在angular 2中将body传递给http delete方法

Ali*_*Ali 1 angular

obj={
    "candidateFeedbackQuestionInfoId": 8
};

jsonobj=JSON.stringify(this.obj);

return this.http.delete(this.feebackUrl,this.jsonobj).map(this.extractData);
Run Code Online (Sandbox Code Playgroud)

如果我们传递body来删除它会抛出类型不匹配错误,任何帮助都会很棒

Pau*_*tha 8

第二个参数delete是a RequestOptionsArgs.所以你可以做到

this.http.delete(this.feebackUrl,{ body: this.jsonobj })
Run Code Online (Sandbox Code Playgroud)