How to hide sidemenu after exiting ion 2
1 answer
You can use the directive menuClose
:
The directive
menuClose
can be placed on any button to close the open menu.
A simple menuClose button can be added using the following markup:
<button ion-button menuClose>Close Menu</button>
or
<button ion-item menuClose>Close Menu</button>
This will cause the menu to close when you select the exit option from the side menu.
If you want more control over the menu, you can use MenuController
and use it to close the menu programmatically, starting with the component code.
import { Component } from '@angular/core';
import { MenuController } from 'ionic-angular';
@Component({...})
export class MyPage {
constructor(public menuCtrl: MenuController) {
}
openMenu() {
this.menuCtrl.open();
}
closeMenu() {
this.menuCtrl.close();
}
toggleMenu() {
this.menuCtrl.toggle();
}
}
+7
source to share