I am running this using phonegap. When i run in Android the logout box is correct and its showing "confirm" as title in the logout box. Even in ios everything is perfect but the logout box shows title as "index.html"(which is the current page name)
$rootScope.logout=function()
{
response=confirm(GetLocalString("HMLOGOUTMSG",_language));
if(response==true)
{
logout();
}
else
{
menuchk();
}
}
I dont want the title as "index.html". Can you suggest a method to not display the title as "index.html"
In ios PhoneGap pages will show the page name in alert, you need to use a plugin for notification. To add the plugin run this code.
cordova plugin add cordova-plugin-dialogs
Usage
navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels])
Example
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
);
The callback takes the argument buttonIndex (Number), which is the index of the pressed button. Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
Now its working fine,
$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']
);
}