Issue with $ionicSideMenuDelegate.$getByHandle() when multiple menus are present


#1

I have two side menus in my app. A full time left menu and part time right menu that is enabled depending on the view.

I am trying to disable the dragging of the right menu when it is disabled. I am doing it with this code:

$ionicSideMenuDelegate.$getByHandle('right-side-menu').canDragContent(false);

However I am getting this error:

[Warning] Delegate for handle “right-side-menu” could not find a corresponding element with delegate-handle=“right-side-menu”! canDragContent() was not called!

Possible cause: If you are calling canDragContent() immediately, and your element with delegate-handle=“right-side-menu” is a child of your controller, then your element may not be compiled yet. Put a $timeout around your call to canDragContent() and try again.

Any ideas what I am doing wrong? Am I adding delegate-handle="right-side-menu" to the wrong element? I am running it inside of $timeout. I’ve tried setting it to 2 seconds timeout to see if that was the cause and made no difference.

Here’s a code pen example:


#2

+1 - having the same issue on latest (1.2.1) - the proposed $timeout solution recommended from the console does not resolve the issue. In addition I’ve tried to get a handle with an ng-click after the DOM completes and experience the same problem.


#3

Forked previous Codepen to include latest Ionic 1.2.4, added appropriate delegate-handle tag attrs, and set timeout to 2000ms from 10. Still experiencing issue.