Unable to close the side menu on button click


#1

I want to close and open the menu programmatically on the button click. I have injected MenuController in corresponding .ts file and tried using the below code. Though i get the correct instance of menu control, the open() and close() method gives no effect.

<button ion-button menuToggle (click)=“menuClick($event)”>

menuClick(event:any){
if((window.innerWidth>=990))
{
if($(“ion-split-pane”).hasClass(“split-pane-visible”)){
this.menuCtrl.close();
}
else{
this.menuCtrl.open();
}
}
else
return;
}

Also i tried using toggle() method and menuClose directive but it doesn’t work.

Note: menuToggle is working correctly in mobile view. But in web view i want to close and open the menu by clicking on the ion-button. So that i have tried the above code.


#2

What do you mean by that?