I'm currently facing an issue where I can successfully retrieve a string and display it on an HTML page, but I am unable to use it as a string in my TypeScript code. Below are the snippets of my code:
TypeScript:
user: User = new User();
constructor(private authService: AuthService, private router: Router) { }
ngOnInit() {
this.user = this.authService.getCurrentUser();
console.log(this.user.email)
}
HTML:
<ion-item>
<ion-label>Email: {{user.email}}</ion-label>
</ion-item>
The email should appear correctly in the HTML output, however, when attempting to log the email using console.log in the browser's console, it returns as undefined.
We apologize for any inconvenience this may cause and appreciate your assistance in advance.