I have this function and body returns a object. Server does not allow json so i need to use application/x-www-form-urlencoded.
Login (body): Observable<Login[]> {
console.log(body);
let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded'});
let options = new RequestOptions({ headers: headers }); // Create a request option
return this.http.post('/logiranje', body, options) // ...using post request
.map(response => {return response}) // ...and calling .json() on the response to return data
.catch((error:any) => Observable.throw(error.json().error || 'Server error' )); //...errors if any
}
Problem is that in Controller i get something like this:
array:1 [
"{\n__"email":_"test@test_com",\n__"password":_"test"\n}" => ""
]
How can i send data so that in controller i can say :
$request->name
or $request->email
Any suggestion?
via uzhas