Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

How refresh menu on a button click

$
0
0

@emiljenson wrote:

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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>