更新时间:2023-01-15 16:04:18
现在,您的deleteCategory()
方法正在使用空的请求正文向指定的端点发出POST请求.
Right now your deleteCategory()
method is making a POST request to the specified endpoint with an empty request body.
这是一个简单的示例,说明如何使用Angulars HttpClient在POST请求中包含对象数组
Here is a simple example on how to include an array of objects in a POST request using Angulars HttpClient
this.http.post('some url', JSON.stringify(yourArrayOfObjects), {headers: ...})
如果您想发送FormData(例如,如果您正在将文件上传到服务器)
If you wanted to send FormData (if for example you're uploading a file to a server)
const frmData = new FormData();
frmData.append("fileUpload", file)
this.http.post('some url', frmData, {headers:...})