Tag: UIL cancels the location return key. SH Roots Register sed return
At that time used is ionic development an app, the demand is, when press the phone's return button, in the specified page double exit, while on the other page click once back to the previous page;
In fact, with Ionic services can be solved:
//Double Exit$ionicPlatform. Registerbackbuttonaction (function(e) {//double-exit when deciding which page to be inif($location. Path () = = '/message ' | | $location. path () = = '/work ' | | $location. path () = = '/mine ' | | $location. path () = = '/login ‘){ if($rootScope. backbuttonpressedoncetoexit) {$rootScope. Disconnect (); Ionic. Platform.exitapp (); } Else{$rootScope. backbuttonpressedoncetoexit=true; $CommonFactory. Showtoast (' Press again to exit the program ', ' short ', ' bottom '); $timeout (function() {$rootScope. Backbuttonpressedoncetoexit=false; }, 2000); } }Else{$CommonFactory. Topback (); } e.preventdefault (); return false; }, 101);
However, I used the Hbuider editor, can debug one side on the phone to see, all appear to not be able to return to exit;
Monitoring the phone return key can also be implemented in Hbuider:
function (e) { plus.key.addEventListener(function(e) { plus.nativeUI.confirm ( function(event) { if (event.index) { plus.runtime.quit (); } null, ["Cancel", "OK"]); false ); });
Because Ionic is based on the PhoneGap compiler platform, there is no effect when debugging with Hbuilder;
Using ionic to develop the phone back button when you encounter the problem ~