Javascript ios上的位置警报
我在iOS上使用ionic创建的应用程序有问题。 在我的主菜单中,当我按下一个按钮时,我的应用程序尝试获取我的位置,并显示两个警报: 一个是意大利语,一个是英语: ITA: 中文:Javascript ios上的位置警报,javascript,ios,geolocation,ionic,Javascript,Ios,Geolocation,Ionic,我在iOS上使用ionic创建的应用程序有问题。 在我的主菜单中,当我按下一个按钮时,我的应用程序尝试获取我的位置,并显示两个警报: 一个是意大利语,一个是英语: ITA: 中文: 第二个警报太难看了。我希望警报是:MYAPP vuole usare la tua posizione。如何更改第二个警报的文本?您可能需要将Cordova位置请求包装在控制器中的ionicPlatform.ready中 .controller("MapController", ["$scope", "$cordov
第二个警报太难看了。我希望警报是:MYAPP vuole usare la tua posizione。如何更改第二个警报的文本?您可能需要将Cordova位置请求包装在控制器中的ionicPlatform.ready中
.controller("MapController", ["$scope", "$cordovaGeolocation", "$ionicPlatform", function($scope, $cordovaGeolocation, $ionicPlatform) {
$ionicPlatform.ready( function() {
$cordovaGeolocation
.getCurrentPosition()
.then(function (position) {
// do something
}
}, function(err) {
// error
});
})
}])
您可能需要将Cordova位置请求包装在控制器中的ionicPlatform.ready中
.controller("MapController", ["$scope", "$cordovaGeolocation", "$ionicPlatform", function($scope, $cordovaGeolocation, $ionicPlatform) {
$ionicPlatform.ready( function() {
$cordovaGeolocation
.getCurrentPosition()
.then(function (position) {
// do something
}
}, function(err) {
// error
});
})
}])
如果您担心外观,可以尝试使用自定义警报,如sweet alert。 JS: 或HTML:
<script src="https://cdn.rawgit.com/t4t5/sweetalert/master/dist/sweetalert.min.js"> </script>
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/t4t5/sweetalert/master/dist/sweetalert.css">
如果您担心外观,可以尝试使用自定义警报,如sweet alert。 JS: 或HTML:
<script src="https://cdn.rawgit.com/t4t5/sweetalert/master/dist/sweetalert.min.js"> </script>
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/t4t5/sweetalert/master/dist/sweetalert.css">
您需要知道Javascript警报和本机警报之间的区别 您可能会使用cordova通知插件,并在其中显示所需的输出 您可以从这里获得插件信息: 并从github repo下载插件 代码实现如下所示:
$cordovaGeolocation
.getCurrentPosition()
.then(function (position) {
//here call the notify method
navigator.notification.alert(message, alertCallback, [title], [buttonName]) // instead of message pass the position
//title it so index.html will not be displaying
}
}, function(err) {
// error
});
您需要知道Javascript警报和本机警报之间的区别 您可能会使用cordova通知插件,并在其中显示所需的输出 您可以从这里获得插件信息: 并从github repo下载插件 代码实现如下所示:
$cordovaGeolocation
.getCurrentPosition()
.then(function (position) {
//here call the notify method
navigator.notification.alert(message, alertCallback, [title], [buttonName]) // instead of message pass the position
//title it so index.html will not be displaying
}
}, function(err) {
// error
});
你能提供一些代码,你正在使用哪些库,以及你的Cordova Location插件的版本吗?你能提供一些代码,你正在使用哪些库,以及你的Cordova Location插件的版本吗?