Within my Angular service, I have the following code:
this.signInService.signIn(this.model).subscribe(user => {
this.user = user,
console.log(this.user.Username)
});
console.log(this.user.Username);
There are two instances of console.log
statements in the code above. The first one, inside the subscribe
function, correctly prints the value. However, the second console.log
statement prints undefined.