Prevent side menu from closing when click

Hi, I there a way to prevent sidemenu from closing everytime i click on it. I want to programmatically close the menu instead of automatic. I’ve tried this.menuCtrl.open() but it doesn’t work:

<ion-menu id='mainMenu' [content]="content">
  <ion-header>
    <ion-toolbar color="primary">
      <ion-title>SureStoreAdmin</ion-title>
    </ion-toolbar>
  </ion-header>

  <ion-content>

    <ion-list>
      <ion-item menuClose ion-item *ngFor="let menu of menus; let i = index;" (click)="openSubmenu(i)">
        {{menu.title}}
        <ion-list *ngIf="i==activeMenuIndex">
          <ion-item menuClose ion-item *ngFor="let submenu of menu.submenu;" (click)="openMenuItem(submenu)">
            {{submenu.title}}
            </ion-item>            
        </ion-list>
      </ion-item>
    </ion-list>


  </ion-content>

</ion-menu>

<!-- Disable swipe-to-go-back because it's poor UX to combine STGB with side menus -->
<ion-nav [root]="rootPage" #content swipeBackEnabled="false" ></ion-nav>

and here’s on my .ts

openSubmenu(i) {
    console.log('openSubmenu')
    this.activeMenuIndex = i;
    this.menuCtrl.open();
  }

I got it working! I just need to remove the menuClose on the

Can’t do this on ionic 4. Did someone have another solution? Thanks.

1 Like