@jagrawal wrote:
Android hardware menu button event
'menubutton'
does not seem to be firing ondocument
.
I have tried adding event listeners in a.run()
block as most people recommend and also in a.controller()
but to no avail..controller(function($document, $ionicSideMenuDelegate){ var menuButtonFn = function(){ console.log('in controller'); $ionicSideMenuDelegate.toggleLeft(); }; $document.on('menubutton', menuButtonFn); document.addEventListener("menubutton", menuButtonFn, false); }) .run(function($rootScope, $ionicPlatform, $cordovaStatusbar) { $ionicPlatform.ready(function() { function menuButtonFn(){ console.log('here now'); $rootScope.$broadcast('menubutton'); } if (window.cordova) { document.addEventListener("menubutton", menuButtonFn, false); } })
I have been testing on a Samsung Galaxy S4 using
ionic run android
`. I don't see any errors or logs in the chrome://inspect view and any other code is definitely not being triggered.
Not sure if I am missing something obvious. Has anyone else had the same problem?
Posts: 3
Participants: 2