1
當我在移動中運行離子apk文件時,我沒有得到我的位置,但系統顯示位置。問題是什麼?離子apk文件沒有獲取位置,但系統顯示位置
Module.js file
angular.module('ionic.example', ['ionic'])
.controller('MapCtrl', function($scope, $ionicLoading, $compile) {
function initialize() {
var myLatlng = new google.maps.LatLng(43.07493,-89.381388);
var mapOptions = {
center: myLatlng,
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"),
mapOptions);
//Marker + infowindow + angularjs compiled ng-click
var contentString = "<div><a ng-click='clickTest()'>Click me!/a></div>";
var compiled = $compile(contentString)($scope);
var infowindow = new google.maps.InfoWindow({
content: compiled[0]
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Uluru (Ayers Rock)'
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
$scope.map = map;
}
google.maps.event.addDomListener(window, 'load', initialize);
$scope.centerOnMe = function() {
if(!$scope.map) {
return;
}
$scope.loading = $ionicLoading.show({
content: 'Getting current location...',
showBackdrop: false
});
navigator.geolocation.getCurrentPosition(function(pos) {
$scope.map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
$scope.loading.hide();
}, function(error) {
alert('Unable to get location: ' + error.message);
});
};
$scope.clickTest = function() {
alert('Example of infowindow with ng-click')
};
});
這裏安裝apk文件後不工作。點擊找到我按鈕它正在加載.....但沒有顯示位置
這是我的代碼。當我運行瀏覽器時,它工作正常,但構建apk文件後,它不顯示細節。你們能告訴我是什麼原因嗎?
當我添加此行時,我得到了這個錯誤ionic.bundle.js:12010 SVG的SMIL動畫(,等)已被棄用,將被刪除。請改用CSS動畫或Web動畫。 ionic.bundle.js:21162 $ ionicLoading instance.hide()已被棄用。使用$ ionicLoading.hide()。 –
naresh