带有查询参数和请求正文的 Angular 11 POST 请求

时间:2021-06-26 23:58:24

标签: angular asp.net-core httpclient

我想从我的 angular 11 应用程序中调用 api。我想要做的是使用命令参数向 api 发送 post 请求 请求包含一个参数和一个正文

enter image description here enter image description here enter image description here

2 个答案:

答案 0 :(得分:0)

你可以像下面这样写

this.http.post(environment.CommercialAPI_SERVICE_URL+`Notes/Post_Note?idTier={idTier}` , note)

答案 1 :(得分:0)

在您的第三张图片中,您缺少一个美元符号

this.http.post(environment.CommercialAPI_SERVICE_URL+`Notes/Post_Note?idTier=${idTier}` , note)
相关问题