Does anybody know know how to refresh sidemenu items on a button click
I have tried with events , but its not working , Find below the code that am trying to use
in a page button click
this.events.publish('job-status-updated', Date.now());
in app components
events.subscribe('job-status-updated', (time) => {
console.log('job-status-updated', 'at', time);
this.manageMenu();
});
manageMenu(){
// used for an example of ngFor and navigation
if(localStorage.getItem('isDutyStarted') == 'false' && localStorage.getItem('isDutyPaused') == 'false'){
console.log('in here menu if');
this.pages = [
{ title: 'Dashboard', component: SummaryPage, menuIcon : 'podium' }
];
}else{
this.pages = [
{ title: 'Dashboard', component: SummaryPage, menuIcon : 'podium' } ,
{ title: 'Assigned Orders', component: OrderListPage, menuIcon : 'clipboard' },
{ title: 'Deliver To Hub', component: DeliverHubPage, menuIcon : 'basket' },
{ title: 'Collect From Hub', component: CollectHubPage, menuIcon : 'cart' }
];
}
I want the menu items to be displayed on the basis of the conditions that i have given