Solution 1 :

That is because ion-menu-button does not emit any event whatsoever, it is merely a controller so it doesn’t even make sense for it to emit anything. You can either attach ionDidClose / ionWillClose events to the ion-menu instance itself or subscribe to MenuController. One really hacky way to achieve what you need (if you really really need to attach the event to the button itself) would be using (click) event.

If you need more information, head over to Ionic documentation: and (

Problem :

How to trigger a function when the ion-menu-button is closed in ionic.
I have a ion-menu-button like this

<ion-buttons slot="end"   >
  <ion-menu-button menu="admin"  >
    <ion-icon name="more" ></ion-icon>

Please help me by telling how to trigger a function when the ion-menu-button is closed. This is the menu list


Comment posted by Mridul

Which function you want to trigger and when?

Comment posted by midhunsivarajan

I want to just trigger a user-defined-function and that too on the close of ion-button.Something like logging to console saying menu close.Actually my purpose is to retrive an id and stored in localstorage when the menu closes

Comment posted by Mostafa Harb

You can either use (ionWillClose)=”some method” or (ionDidClose)=”some method”

Comment posted by midhunsivarajan

@Mostafa Harb I tried that but it is not working’

Comment posted by midhunsivarajan

I have shown an image when i click the name in the list the ion-menu close.But nothing is logged in console

Comment posted by midhunsivarajan

Jiri Kraloevec .Can you please give me a code snippet which shows how to attach ionDidClose on the ion-menu

Comment posted by midhunsivarajan

I want to retrieve an id from menu as shown in figure when the slider closes on clicking lists.

Comment posted by Jiri Kralovec

In that case, you can have a callback function opening a specific menu via the MenuController (