您好我的Google Maps API存在问题。我得到了太多的递归"错误。
当我尝试将标记添加到边界时,我得到了错误。我使用API v3。
我在问题上搜索了最近6个小时:/
这是我的代码:
angular.module('starter', ['ionic'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.controller('MapController', function($scope, $ionicLoading, $http) {
google.maps.event.addDomListener(window, 'load', function() {
var mapOptions = {
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var markerBounds = new google.maps.LatLngBounds();
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
$http.get('files/events.json')
.success(function(res){
angular.forEach(res.markers, function(value, key) {
var marker1 = new google.maps.Marker({
position: new google.maps.LatLng(value.laenge, value.breite),
map: map,
title: value.title
});
markerBounds.extend(marker1.position);
});
});
navigator.geolocation.getCurrentPosition(function(pos) {
var testposition = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
var myLocation = new google.maps.Marker({
position: testposition,
map: map,
title: "My Location"
});
markerBounds.extend(myLocation.position);
map.setCenter(testposition);
map.setZoom(map.fitBounds(markerBounds))
});
$scope.map = map;
});
})