I have this method in my angular service I want it to hit a the controller in my asp.net CORE api. But it does not hit my controller. I have tried to make the post in Postman and it works. I do not understand why my post in Angular does not work Thank you for your help.
addFamily(family: Family) { this.http.post<Family>('https://localhost:44344/api/componentFamily', JSON.stringify(family)) } Here is my ASP.NET CORE API.
// POST api/componentFamily [HttpPost] public async Task<IActionResult> Post([FromBody] ComponenFamilyViewModel componentFamilyViewModel) { Family family = new Family(); family.FamilyId = componentFamilyViewModel.FamilyId; family.FamilyName = componentFamilyViewModel.FamilyName; await _componentFamilyService.AddFamily(family); return CreatedAtAction("Get", new { id = family.FamilyId }, family); }