Disable Side Menu from Template or associated Controller?


#1

Is there an easy way to enable or disable the side-menu based on what template is loaded in the view or does this have to be completed through a function?

If it does need to be manipulated within the controller, what would that code look like?

Is there any sort of tag like the has-header in ion-content or hide-back-button in ion-view that can be added to disable the side-menu?


Implementing swipe within ion-side-menu-content
#2

See these previous topics:


You very well may want to setup your views so that you have a main template file that will be used for views that need a menu and a completely other main template file that would be used for views that don’t need a side menu.

Here is a good blog on the topic:

http://sudostack.com/side-menus-in-the-ionic-framework/


#3

Thanks, I saw those other posts in my search prior to posting, but they didn’t really seem. That blog, on the other hand, is written about the exact same issue I’m facing.

For immediate term I’m just disabling drag. When I have time I’ll dig into the router to gain better understanding and solve it the right way like in that blog post.

Was hoping there was an easier way, maybe a directive that looks for dragDisabled in the ion-view tag which disables dragging to the side menu. I could see it being an issue for highlighting text and other applications that could mistakenly trigger the side menu.

Thank you.


#4

The drag-content="false" really does the trick and the no-drag-right directive in my Plunker works too:


#5

Maybe I’m looking at something wrong, but that plnkr doesn’t seem to be working.
Did one of the recent ionic updates break it?


#6

That Plunker is running 0.9.22. It works fine. On the “Home” page, you can drag open the menu. On the “About” page you cannot.

Here is a 0.9.26 version: http://plnkr.co/edit/Zpg3fgMuXnqLWDhj5SMj


#7

I’ve resolved what I’m doing in my app, so no further assistance needed on this, but the drag-disabled still isn’t working for me on either of the plunkers you posted.

I created a quick youtube of my interaction with the latest plunker in case it might help you diagnose any problems with the framework. I’m not comfortable making the link public, so shoot me an email at info (at) origindev (dot) com and I’ll send you the link.

Thanks for all your help.


#8

hi… today i was just working on this: a secondary (disabled by default) sidemenu. to be activated and show only on subpage 8i use it to show the “chapters” of the book to be read.

you can check my code here: https://github.com/krur/Silo_app (the BookController and relative views)


#9

Thanks for the input. I just watched your YouTube post and saw you were using Firefox. You are right - in Firefox the no-drag-right and drag-content="false" doesn’t work.

Being that Ionic doesn’t really support desktop, I guess it’s not “really” a bug. Also keep in mind that I made that little demo; so, it’s far from perfect and certainly not official.

http://ionicframework.com/docs/overview/#browser-support

Despite that, it’s an interesting issue. It makes me wonder what would happen on a FireFox OS device. The devs have one; so, I will ping them to see what’s up.


Unable to turn on and off Sidemenu functionality
Stop Side Menu Drag to Open
[Nightly] Can I use custom Side Menu on a specific page?
#10

UPDATE : The flaw is completely in my no-drag-right directive. It didn’t work in Firefox. However, the drag-content="false" works perfectly.

Here’s a sample : http://plnkr.co/edit/WZFRfSfV2zVt1igpC3jY?p=preview


Hide the menu and the menu button on specific pages
#11

This doesn’t seem to be working in my app.
Does this attribute still work?