Hi, I am getting user object as undefined though the method that is returning the user object is not null. Please help
Component call : this.user = this._authService.login(this.email, this.password) // here this.user is comming undefined Service method login(email : string , password : string): User { this.checkLogin(email, password).subscribe((data)=>{ //console.log(data); this.usr = data; console.log(this.usr.name); if(this.usr != null) { return this.usr; // this.usr has value } }) } -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/angular/d7065033-73df-4952-a2c7-d159b2939457n%40googlegroups.com.