Answer the question
In order to leave comments, you need to log in
How to pass request parameters using url in angular 6?
The back-end fails to read the data that comes in JSON.
You need to pass them to the url.
For some reason, json still comes in, with this Content-Type:
private headers: HttpHeaders = new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded',
});
constructor(private http: HttpClient){}
loginWithEmailAndPassword(email: string, password: string){
return this.http.post(this.url, {email: email, password: password}, {headers: this.headers});
}
Answer the question
In order to leave comments, you need to log in
const body = new HttpParams()
.set('email', email)
.set('password', password);
this.http.post('/login',
body.toString(),
{
headers: new HttpHeaders()
.set('Content-Type', 'application/x-www-form-urlencoded')
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question