0
私のアプリケーションではIonicに問題があります。私は私のページに地図を表示するためにGoogleマップを使用します。初めて正しく表示されます。しかし、別のビューに移動して私のページに戻ったとき、それはマップを含んでいたが、マップは現れなかった。これは、イオンは、ビューのロードを処理する方法が原因である可能性がありイオングーグルマップはリフレッシュ後に表示されます
.controller('MapController', function($scope, $ionicLoading,$state) {
google.maps.event.addDomListener(window, 'load', function() {
var myLatlng = new google.maps.LatLng(37.3000, -120.4833);
var mapOptions = {
center: myLatlng,
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
navigator.geolocation.getCurrentPosition(function(pos) {
map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
var myLocation = new google.maps.Marker({
position: new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude),
map: map,
title: "My Location"
});
});
$scope.map = map;
});
})