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: https://ionicframework.com/docs/v3/api/components/app/MenuController/ and (https://ionicframework.com/docs/api/menu#events.
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>
</ion-menu-button>
</ion-buttons>
Please help me by telling how to trigger a function when the ion-menu-button is closed.
https://imgur.com/a/Vz2XpGq. This is the menu list
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
I have shown an image when i click the name in the list the ion-menu close.But nothing is logged in console
Jiri Kraloevec .Can you please give me a code snippet which shows how to attach ionDidClose on the ion-menu
I want to retrieve an id from menu as shown in figure when the slider closes on clicking lists.
In that case, you can have a callback function opening a specific menu via the MenuController (