我在项目中有一个标签页,点击Android硬件后退按钮应该返回上一个标签而不是上一页 . 怎么做?
更具体地说,有没有办法覆盖每个控制器(页面)而不是app.js中的后退按钮?
答案来自http://www.gajotres.net/ionic-framework-handling-android-back-button-like-a-pro/2/ .
app.controller('TheFirstController', function($scope, $ionicPlatform) { var deregisterFirst = $ionicPlatform.registerBackButtonAction( function() { alert("This is the first page"); }, 100 ); $scope.$on('$destroy', deregisterFirst); });
1 回答
答案来自http://www.gajotres.net/ionic-framework-handling-android-back-button-like-a-pro/2/ .