Android 如何在ios移动应用程序中显示注销警报框
我正在使用phonegap运行此程序。当我在Android中运行时,注销框是正确的,并且在注销框中显示确认为标题。即使在ios中,一切都很完美,但注销框显示的标题为index.htmlwhich,即当前页面名称Android 如何在ios移动应用程序中显示注销警报框,android,angularjs,mobile-application,phonegap,Android,Angularjs,Mobile Application,Phonegap,我正在使用phonegap运行此程序。当我在Android中运行时,注销框是正确的,并且在注销框中显示确认为标题。即使在ios中,一切都很完美,但注销框显示的标题为index.htmlwhich,即当前页面名称 $rootScope.logout=function() { response=confirm(GetLocalString("HMLOGOUTMSG"
$rootScope.logout=function()
{
response=confirm(GetLocalString("HMLOGOUTMSG",_language));
if(response==true)
{
logout();
}
else
{
menuchk();
}
}
我不希望标题为index.html。你能建议一种方法不将标题显示为索引吗?在ios PhoneGap页面中,html将在警报中显示页面名称,你需要使用插件进行通知。 要添加插件,请运行以下代码
cordova plugin add cordova-plugin-dialogs
用法
navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels])
消息:对话框消息。一串
confirmCallback:在按下按钮1的索引时调用的回调,
2或3,或者当对话框在没有按钮的情况下关闭时,按0。
作用
标题:对话框标题。字符串可选,默认为确认
buttonLabels:指定按钮标签的字符串数组。大堆
可选,默认为[确定,取消]
范例
function onConfirm(buttonIndex) {
alert('You selected button ' + buttonIndex);
}
navigator.notification.confirm(
'You are the winner!', // message
onConfirm, // callback to invoke with index of button pressed
'Game Over', // title
['Restart','Exit'] // buttonLabels
);
回调采用参数buttonIndex Number,它是所按下按钮的索引。请注意,索引使用基于一的索引,因此值为1、2、3等
现在它可以正常工作了
$rootScope.logout = function () {
function onConfirm(buttonIndex) {
if (buttonIndex == 1) {
logoutfunc();
}
else {
menuopenchk();
}
}
navigator.notification.confirm(
'Are you sure to logout?',
onConfirm,
'Logout',
['Yes', 'Not Now']
);
}
cordova插件添加cordova插件对话框,是cordova插件还是phonegap插件start@AmruthaJRaj我不明白你在评论中的意思是什么,是像cordova插件添加cordova插件对话框还是phonegap插件添加cordova插件对话框,只需阅读thisnavigator.notification.confirm“您确定要注销吗?”、onconfirButtonindex、“注销”、“是”、“不是现在”] ; 是这样吗??