在我的电脑上,我也添加了依赖项ui-map和ui-event,但是当我启动应用程序时,控制台日志说google没有定义,更准确地说是我代码的第五行
这是我的代码 http://jsfiddle.net/Lw9XW/
//Add the requried module 'angular-ui' as a dependency
angular.module('maptesting', ['ui.event','ui.map','ui.directives']);
function MapCtrl($scope) {
var ll = new google.maps.LatLng(13.0810, 80.2740);
$scope.mapOptions = {
center: ll,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
//Markers should be added after map is loaded
$scope.onMapIdle = function() {
if ($scope.myMarkers === undefined){
var marker = new google.maps.Marker({
map: $scope.myMap,
position: ll
});
$scope.myMarkers = [marker, ];
}
};
$scope.showMarkerInfo = function(marker) {
$scope.myInfoWindow.open($scope.myMap, marker);
};