Ionic back key in Android
Several return events have been registered in the Ionic framework, namely the view Sidemenu modal Actionsheet popup loading their priority is
- view:100
- sidemenu:150
- modal:200
- actionsheet:300
- popup:400
- loading:500
Now we first to implement similar QQ and the page containing tabs click Back to exit the application, assuming that the configuration of the route in the tabs page of the State Name has tab (Note: The code $ionicplatform and $ionichistory are required to inject )
// 返回键$ionicPlatform.registerBackButtonAction(function() { if ($ionicHistory.currentView().stateName.indexOf(‘home.index‘) > -1) { if ($scope.isHomePage == 0) { $scope.getHomePage(); } else { ionic.Platform.exitApp(); } } else { // navigator.app.backHistory(); // 交给其他注册事件处理 }}, 101);
Because the view priority is 100 when the page returns, the priority here is higher than 100, which I set here is 101.
Ionic back key in Android