Disable sidemenu in specific pages ionic 2 framework

I’m not sure whether its me or it feels for everyone the same that ionic 2 is pretty different from the first one, thus none of those tutorials online are applicable to problems you are sarching for.

Anyway straight to the point I’m going to show you how to disable the side menu (any menu also will work) on specific pages. Lets say in my Case I had a login screen which I did not want the menu to be at.

First thing first is to open your app.html file. where the menu is actually included. Find the opening tag for the menu. So you should be having something like:

<ion-menu [content]="content">

Add an id to your menu so it will be something like this:

<ion-menu id="myMenu" [content]="content">

Alright not we have to make changes to the javascript file of our page. let say my page name is login and the javascript file is called login.js. What you should do is to import “MenuController” from “ionic-angular” package. The NavbarController Should Already be imported, so you can just call in MenuController in the same line like:

//Before:
import {NavController} from 'ionic-angular';

//After:
import {NavController, MenuController} from 'ionic-angular';

now pass menu to your construct function. so it will be like constructor(nav, menu).

Then within the constructor define the menu and disable it by using:

    this.menu = menu;
    this.menu.enable(false, 'myMenu')

so the final code will look like:

  constructor(nav, menu) {
    this.nav = nav;
    this.menu = menu;
    this.menu.enable(false, 'myMenu')
  }

That is it.

Incoming search terms:

  • disable side menu ionic 3
  • ionic3 disable bounce android
  • disable slitpane on specific page ionic
  • https://hazaveh net/2016/06/disable-sidemenu-in-specific-pages-ionic-2-framework/
  • ionic 2 how to disable and enable side menu
  • ionic 2 login sidemenu
  • ionic 2 side menu 2016
  • ionic disable menu
  • ionic menu disabling

Join the Conversation

7 Comments

  1. Yeah this is actually what i am facing now. I want to disable the side menu for my login page. The problem is that the side menu has to bee added at the app.html under the tag. This is what i am searching for. Thank you very much. Keep this post live.

  2. it’s working but its disable on all page
    what can i do now, can you please suggest someother ideas for this

Leave a comment

Leave a Reply