I have this data coming from form using <form #form=“ngForm” (ngSubmit)=“myFunction(form.value)”>
I am sending the form value to HTTP post method as
myFunction(formData){
let headers = new HttpHeaders({
‘Content-Type’: ‘application/x-www-form-urlencoded’,
});
return new Promise( resolve => {
this.http.post(this.my_api, formData, { headers: headers})
.subscribe( data => {
resolve(data);
});
});
}
When i console the form.data, i get
{name: ‘myname’, address:‘myaddress’}
But
what i get in the api is
{{“name”:“myname”, “address”:“myaddress”} : null }
which is making me hard to get the values in my backend.
P.S. I am using Laravel as Backend
Why is that : null is getting appended to the request?
How to get the values in the Laravel backend?