I am using angular 8
Tried visiting the api endpoint on browser, check if the URL is correct, and maybe include access control allow origin in your header
Im not sure but please check this......
This Should be your service file code
userlogin(userid, smpassword) {
const params = new HttpParams()
.set('user_id', userid)
.set('sm_password', smpassword);
console.log(params);
return this.http.post(this.baseUrl+'user/login',JSON.stringify(params)).pipe(map((res) => {
return res;
}));
}
This Should be your login.component.ts
login() {
const email = this.Userlogin.get('email').value;
const password = this.Userlogin.get('password').value;
this.rest.userlogin(email, password).subscribe((result)=> {
result = JSON.Parse(result)
console.log(result);
}
);