First I set up my headers:
this.headers.append("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
then I user http.put so send the request
isExistingEmail(email:string):void{
this.http.post(
GLOBAL_CONST.apiPath + "/user/user/api-check-user-email",
{email:email},
{headers:this.headers}
)
.map(res => res.json())
.subscribe(
(data) => {
console.log(data);
},
(err) => {
console.log(err);
}
);
}
The problem is, that you trying to send JSON data, instead of Form data.
You should replace {email:email}
with something like "[email protected]"
- it should be a string, fortunately we have template strings in TS (ES6), use them