hope this fix your issue this.authService.getCurrentUser() is an asynchronous call, which means it takes some time and the next lines gets executed first. Therefore you are getting undefined in console.log() To console the value, you may try like this:
var in ionic template undefined, but console.log displays it
By : user3097418
Date : March 29 2020, 07:55 AM
wish helps you The main problem is that you are trying to render data which are not loaded yet. subscribe() is an asynchronous function, so you have to wait for the data from there. There are two ways to do it.