我有基本的离子应用程序,我已经禁用了应用程序上的后退按钮,是否有一个原因,后退按钮仍然在
Android设备上工作?
我目前正在测试离子视图.
这是我的代码:
.run(function($ionicPlatform) { $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); } if(window.StatusBar) { // org.apache.cordova.statusbar required StatusBar.styleDefault(); } }); $ionicPlatform.registerBackButtonAction(function(e) { e.preventDefault(); },101); })
解决方法
根据离子
documentation
Your back button action will override each of the above actions
whose priority is less than the priority you provide.
并且鉴于您希望在所有情况下完全禁用后退按钮,并且引用列表中的操作的最高优先级为500,您应该提供超过500,600的优先级值.放置在$ionicPlatform.ready()中时,下面的代码应该可以工作
$ionicPlatform.registerBackButtonAction(function(e) {},600);