Hi, i was following the conference app examples for the multiple menus on same side, everything works fine until i reload, when i reload the app, it sets the default menu.
in the app.ts’s constructor i have this code, like in the conference app to check login state and enabling one menu or the other depending:
this.localStorageProvider.checkLoginState().then((loggedIn) => {
this.enableMenu(loggedIn === 'true');
}).catch(error => {
console.error(error);
});
and then in the enableMenu i have:
enableMenu(loggedIn){
console.log('Current loggedIn: '+ loggedIn);
this.menu.enable(loggedIn, 'logged-in-menu');
this.menu.enable(!loggedIn, 'logged-out-menu');
}
the enable menu only works after the page is loaded and an event is triggered, but when i reload the app, it sets the default menu again, i tried triggering an event on from the constructor, but got the same result.
need help here!
PD: I just cloned the conference app and its doing the same thing! menu.enable not working on app reload.
UPDATE: I solved it by setting a timeout of 500 ms on the constructor like this:
this.localStorageProvider.checkLoginState().then((loggedIn) => {
setTimeout(() => {
this.enableMenu(loggedIn === 'true');
}, 500);
}).catch(error => {
console.error(error);
});
i guess this is being looked into right?