I have the following WEB API method, and have a SPA template with Angular:
[HttpPost]
public IActionResult Post([FromBody]MyViewModel model)
I thought, based on this topic, there is no need to use [FromBody]
here, since I want to read the value from the message body, so there is no need to override the default behavior, but, if I don't use [FromBody]
, the model that is coming from Angular is null. I'm really confused, why should I use [FromBody]
, since I have used the default behavior?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…