How to capture menu API output events?


#1

According to the documentation at https://ionicframework.com/docs/v2/api/components/menu/Menu/ the menu has Output events.

How do I react to those events?

I thought I would be able to do this:

<button ion-button menuToggle (click)="toggleMenu($event)" (ionOpen)="toggleMenu($event)">
  <ion-icon name="menu"></ion-icon>
</button>

but it doesnt work?

The click event is handled but the other doesnt come through?


#2

Can a mod please close this.

The solution, thanks to @nakulgulati on the Ionic Slack channel for the help, was to add subscribe to the observable on the menu controller like this:

  this.menuCtrl.get().ionOpen.subscribe(()=>{
    //Do your stuff here.
  });

Obviously, you need include and instantiate the menu controller in the project.


#3

Thank you for posting this! I couldn’t find how to listen for an event anywhere in the documentation.