Hello, I am having an issue with the code below that is making a rest call to a node.js backend endpoint in this ionic app. When I run the code, it gives me the following error. How can I resolve this?
Error:
ERROR in src/app/services/user.service.ts(22,5): error TS2322: Type 'Subscription' is not assignable to type 'Observable<any>'.
[ng] Property '_isScalar' is missing in type 'Subscription'
TypeScript Code:
//Method for user login
loginService(username: string, password: string):Observable<any>
{
return this.http.post(url+"/login",{"Username": username,"Password": password}).subscribe((val) => {console.log("POST call successful value returned in body",val);}, response => { console.log("POST call in error", response); }, () => { console.log("The POST observable is now completed."); });
}