I need trigger a function when SideMenu
is open.I searched for this and got this link https://forum.ionicframework.com/t/possible-to-trigger-expression-on-opening-sidemenu/4381 for ionic-1 but how can I achieve this in ionic 2 ? Thanks in advance.
You have to inject MenuController
in your page, and then you can access the isOpen()
method.
import{Page, MenuController} from 'ionic-angular';
@Page({...})
export class MyPage {
constructor(private menu: MenuController) {
if menu.isOpen() {
// do something
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.