I am creating an application with a welcome page, login and home.
I want to show data in the ion-menu, and this is obtained from the native storage and the native storage is filled using the login.
when starting the app, the ion-menu starts; then the ion-menu begins to obtain the data from the native storage but it will not acquire anything, since the user has not gone through the login and when the user logs in and opens the ion-menu, it loads strange data.
I would like to be able to initialize the ion-menu after the login so that it is possible to get the data correctly from the native storage.
- app.component.htm
<ion-app>
<app-menu></app-menu>
<ion-router-outlet id="main"></ion-router-outlet>
</ion-app>
- menu.component.ts
async ngOnInit() {
console.log('starts with the app');
this.name = await this.storage.get('name');
this.email = await this.storage.get('email');
}
- menu.component.html
<ion-menu side="start" type="push" menuId="principalMenu" contentId="main">
<ion-header>
<ion-toolbar id="headerMenu">
<ion-avatar id="avatarProfile">
<img src="https://www.iconfinder.com/data/icons/ios-7-icons/50/user_male2-512.png">
</ion-avatar>
<ion-label id="textProfile">
<h3 id="nameProfile">{{ this.name}}</h3>
<p id="emailProfile">{{ this.email}}</p>
</ion-label>
</ion-toolbar>
</ion-header>
<ion-content>
</ion-content>
</ion-menu>