Sumchans
Sumchans

Reputation: 3774

Trouble with Angular HttpClient delete statement

Here is my call to the delete method to the service from the component.

  constructor(private wos: WorkorderService) {}
  canceled(workOrder) {
    this.wos.deleteWorkOrder(workOrder);
  }

Here is the delete method on the service.ts file

 deleteWorkOrder(workOrder) {
   this.http.delete(this.BASE_URL + '/deleteworkorder/' + 
   workOrder.accountNumber).subscribe((response) => {
    console.log("deleted");
  })
}

And this is the error message I get on the console:

ERROR Object { headers: {…}, status: 0, statusText: "Unknown Error", url: null, ok: false, name: "HttpErrorResponse", message: "Http failure response for (unknown url): 0 Unknown Error", error: error }

The API works fine as I have tried the statement with Postman. Please advise!

This is what I see on the network section of the browser: enter image description here

Upvotes: 2

Views: 1626

Answers (1)

Natxo
Natxo

Reputation: 51

This issue has driven me crazy for quite a long time. Just in case it can help anybody, my problem was the version of the .NET Core SDK: I had the version 2.2.101 and I had to upgrade to the 2.2.104. Cheers!

Upvotes: 1

Related Questions