【发布时间】:2017-02-23 00:28:06
【问题描述】:
嗨,我有这段代码来运行我的 api 方法
export class MessageService {
constructor(private http: Http) {
}
addMessage(textToSend: string) {
return this.http.post("/api/SendMessage", textToSend); //<- Everytime i have some text in textToSend and this is ok
}
}
在我的 Api 之后,我的参数等于 null
[HttpPost]
[Route("/api/SendMessage")]
public void SendMessage(string msg) //null value
{
//some code
}
【问题讨论】:
-
当然它不会传递任何参数,它是您在方法中请求的查询参数
标签: c# api angular asp.net-core