如何让硬件后退按钮成为退出的应用程序 [英] how do make hardware back button become exit app
本文介绍了如何让硬件后退按钮成为退出的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现这个code,但其对JavaScript:
I found this code but its for javascript:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(){
document.addEventListener("backbutton", function(e){
if($.mobile.activePage.is('#homepage')){
e.preventDefault();
navigator.app.exitApp();
}
else {
navigator.app.backHistory()
}
}, false);
}
这种情况下,就像是我的情况,我想使后退按钮成为我的应用程序的退出方式时,在某些页面(本例中为/ home),但这code用JavaScript编写,我想在angularjs使这个,我怎么写呢?谢谢
this case is like my case, that I want to make the back button become the exit way of my app when in certain page (in this case is /home) but this code is written in javascript, I want to make this in angularjs, how do I write it? thanks
推荐答案
角是JavaScript的。这code进行任何修改具有角工作,你只需要将其添加到您的应用程序。
Angular is JavaScript. This code requires no modification to work with angular, you just need to add it to your app.
这篇关于如何让硬件后退按钮成为退出的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文