0

I need to do a delete request that takes 2 parameters, but I'm not really sure how to do it.

my code looks like this:

public deleteDefinition(typeName: string, id: number) {
    console.log("in API call");
    const path = `${this.apiEndpoint}/Definition/Delete/`;
    return this.http.delete(path, typeName, id)
        .map((response: Response) => response.json())
        .catch(this.handleError);
}

But I keep receiving the errror

Supplied parameters do not match any signature of call target.

What is wrong with my syntax?

Thanks in advance!

4
  • 1
    The signature is http.delete(url, options). You should include the id in the url. As for your typeName param, I don't know what it means. Commented Feb 16, 2017 at 13:55
  • @AngularFrance okay so I changed my variable path to include the params, and now I do a return this.http.delete(path) however, nothing happens. in my console I can't even see the request, so is it not doing the call at all? Commented Feb 16, 2017 at 14:04
  • 2
    Observables are executed only when they are subscribed. Can you confirm that somewhere in your code you have something like XXX.deleteDefinition(a, b).subscribe()? Commented Feb 16, 2017 at 14:06
  • @AngularFrance that fixed it, thanks! Commented Feb 16, 2017 at 14:11

1 Answer 1

2

passing a body message to an HTTP DELETE action is not currently supported in Angular 2. HTTP DELETE calls are also not meant to be send with extra info in the body.

One solution would be to change the URL structure so you don't have to provide information in the body.

Another solution is to use POST instead of DELETE. POST does allow you to provide a message body.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.