我试图通过硬件后退按钮阻止回到上一页使用这个:
$ionicPlatform.onHardwareBackButton(function () {
if($state.$current.name=="authentication") {
$ionicPopup.confirm({
title: 'System warning',
template: 'Are you sure you want to exit?'
}).then(function(res){
if( res ){
navigator.app.exitApp();
}
})
}
});
但它不起作用 . 出现警告弹出框时,它仍会返回上一页 .
我怎么能阻止它?
1 回答
你可以试试这个,