How to close ion-side-menu programitically?

I have a ion-side-menu,on clicking ion-side-menu i have a list of items ,on further click on that item i generate a pop-up. On clicking ‘OK’ button in the pop-up i navigate to some other html page. I want to close my right side menu on click on that ‘OK’ button in my pop-up.My menu remains open after navigation to another page.

I used menu-close on that ‘OK’ button. its not working .

Can anyone please help me.

1 Like

Use ionicSideMenuDelegate, see documentation at: http://ionicframework.com/docs/api/service/$ionicSideMenuDelegate

2 Likes

You can also use menuClose if you want to clear the history stack & close the menu before navigating to that page.

I do not want my side menu to close when I click cancel button on my pop-up. By using menu-close what is happening is my side menu closes and then pop up comes and then it navigate to other page.

I have a cancel button on pop-up,on click of which my right side menu should remain open.

1 Like

Can you create a codepen of this and/or explain better what you are trying to do?

You said in the original post you want the menu to close, now you’re saying you don’t?

Yes definitely I want my menu to close on click of some another button that is not on my side menu.

Thank you all for your help. I found answer to my problem. What i have done is i have toggled my menu again on click of that button.

$scope.onClickButton= function () {
if($ionicSideMenuDelegate.isOpenRight())
{
$ionicSideMenuDelegate.toggleRight();
}
$state.go(‘someAnotherPage’);
}

2 Likes