Ionic – close menu on navigation

I’m working on an Ionic app and I stumbled upon this problem where the side menu does not close whenever I tap the menu item. It navigates to the page, but the menu stays open.

Ionic menu not closing

The solutions I found were either outdated or not pretty enough for my taste, so I came up this one:

// app.component.ts

this.platform.ready().then(async () => {
    // ... => {
        if (event instanceof NavigationEnd) {

We’re listening for all the events emitted by the ionic router and close the menu whenever we receive a NavigationEnd event.


You can also wrap your menu items with `ion-menu-toggle` like so:

    <ion-item routerLink="/tabs/store">
      <ion-icon name="home" slot="start"></ion-icon>
      <ion-icon name="person" slot="start"></ion-icon>