I am trying to call post api on button click but I shows this error:
Supplied parameters do not match any signature of call target
Code:
changeStatus(id) {
this.http.post('https://localhost:44300/api/apis/ChangeStatus/' + id)
.subscribe(
data => this._data = data.json(),
err => this.logError(err)
);
}
post
method requires at least two parameters, first 'URL', and second 'Body' and in your code you are just passing URL not body.
http.post
expects a body to be sent to the target host.
http.post(url, body, requestOptions)
So if you just want an empty body, because you have no additional data to send, you could do this:
changeStatus(id) {
// mind the empty string here as a second parameter
this.http.post('https://localhost:44300/api/apis/ChangeStatus/' + id, "")
.subscribe(
data => this._data = data.json(),
err => this.logError(err)
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With