I hope everyone is doing great. I\'ve recently started working with angular 4.4, i\'ve been trying to post data to my api server, but unfortunately it\'s not working. I\'ve spen
I solved it by setting the Content-Type to application/x-www-form-urlencoded
:
const headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
const options = new RequestOptions({ headers: headers });
const params = new URLSearchParams();
params.append('mypostField', 'myFieldValue');
http.post('myapiendpoint.com', params, options).subscribe();