0

My Angular 8 service is executed but the API Method is not.

Angular Service:

createFile(mapping: UniqueCustomerTestMatched[] {
    const endpoint = 'https://localhost:44398/api/mapping/createFiles';
    this.loading = true;
    var data = JSON.stringify(mapping);
    console.log("Sending mapping to API: " + data);
    return this.httpClient.post(endpoint, { fileContent: data});
}

ASP.NET API:

[HttpPost("createFiles")]
    public ActionResult<List<CustomerTestMatched>> CreateFiles([FromBody]UploadInfo rawData)
    {

What could it be? I've implemented other post methods the exact same way that work.

Thanks a lot!!!

0

1 Answer 1

2

Looks like you're just missing a subscribe method at the end.

Should be:

this.httpClient.post(endpoint, { fileContent: data}).subscribe()

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.