ui-map google未定义

时间:2014-02-25 08:26:38

标签: angularjs google-maps angular-ui

像标题一样,当我尝试使用ui-map模块时,我收到了这个错误。 我尝试使用此示例http://jsfiddle.net/sjmcpherso/9kF7d/

在我的电脑上,我也添加了依赖项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);
};

0 个答案:

没有答案