Documentation for Side Menu Controller

Hi there, I’m playing around with the side menu controller, looking at the documentation here: http://ionicframework.com/docs/angularjs/controllers/side-menu/

In the usage section I see this: $scope.sideMenuController.toggleLeft();

I’m wondering, is there a place where I can find a list of all the functions I can call for this controller?

Hi @boozedog,

We have new source-generated documentation ready for the beta release, and are ready to release it extremely soon. Stay tuned. You will have documentation of all the methods, properties & attributes on every directive, controller & service.

Hi @andy I was looking around in the new docs and came across the new declarations for the ionicSideMenus controller for the directive ion-side-menus and therein it states to toggle the sidemenu with $scope.$ionicSideMenusController.toggleLeft() but that does not work for me!

I’m trying to future-proof my code so I’m using the nightly build, is there something I’m missing at the moment? Great work you guys are doing by the way!

Can you put up a CodePen sample so we can see what’s going wrong?

1 Like

Thanks @andy ! Can I have a quick peek at a preview of the new docs?

http://ajoslin.github.io/docs/nightly

Thanks @andy!

Another question … is it possible to disable the side menu programatically?

Looking here http://ajoslin.github.io/docs/nightly/api/controller/ionicSideMenus/ I don’t see any methods that support this.

Since this is an all-side-menu-topic I think it’s the appropriate place to ask my question as well:

How do I verify that the side menu is actually closed? I want to initialize my code after the side menu is completely closed since an iPhone 4 doesn’t perform that well when initializing a map with 100s of tiles while animating the whole thing.

Thanks.

Edit: Ooh damn. Nevermind I got it already. No need for events on this one. Just do this to verify that the side menu is closed:

$scope.$watch(
	function () {
		return $scope.$ionicSideMenusController.isOpenLeft();
	},
	function (isClosed) {
		if (isClosed) {
                        // Do stuff here
		}
	}
);

@Calendee please check this http://codepen.io/tolu360/pen/Lzvxh - the issue with $ionicSideMenusController.toggleLeft() seems to persist for nightly build.

@tolu360 fixed in latest nightly! There indeed was a problem with ion-nav-buttons’s scope.

Should be up within 30 minutes ( or after github is back up. someone ddosing them again :-[ )

1 Like

@andy alright man! Thank you for looking into it and for the fix. I guess this is what comes with living on the edge!

So, the side menu will only close when the menu icon is tapped. It will not open.

Opened Issue # 864 : https://github.com/driftyco/ionic/issues/864 with demo.

Andy, I just tested and did a demo? Did we cross paths or is something still wrong?

Anybody have thots on this question? Should I get in there and write my own function and submit a pull request? :slight_smile:

@Calendee, @andy the issue still persists. What tool did you use to create your demo gif?

@Calendee: There was a different bug at the same time, not always particular to this exact example.

@tolu360 Try now - the build just finished (I took awhile to push it, was testing it with some other things).

I just tried here http://codepen.io/tolu360/pen/Lzvxh, menu still wont toggle.

Hi @tolu360 - now you actually have a problem of scoping! In MainCtrl, the ion-side-menus is inaccessible because it is on a child scope.

You have a couple of choices:

  1. assign ion-side-menus to rootScope or the like with <ion-side-menus controller-bind="$root.mySideMenus">
  2. Put MainCtrl underneath the ion-side-menus directive

Thanks for helping @andy. I just went with 2 above, toggle works now!