【发布时间】:2016-09-30 03:05:09
【问题描述】:
我正在尝试使用 android 菜单按钮打开我的侧边菜单。我在网上找到了这个解决方案:
Ionic/Cordova menubutton event not called
但这对我不起作用。这是我的代码:
var starter = angular.module('starter', ['ionic', 'starter.controllers'])
.run(function ($ionicPlatform, $rootScope, $state, $ionicSideMenuDelegate) {
$ionicPlatform.ready(function () {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
document.addEventListener("menubutton", onMenuKeyDown, false);
function onMenuKeyDown() {
alert("some menu pops pup!! ");
// here change the view , etc...
$rootScope.$apply();
}
});
})
【问题讨论】:
标签: android menu ionic-framework