Google Maps API OverlayView()在AngularJS指令中不起作用

Google Maps API OverlayView() not working in AngularJS directive

本文关键字:AngularJS 指令 不起作用 Maps API OverlayView Google      更新时间:2023-09-26

我的指令"map"中的命名空间现在有问题,因为mapInit()函数做得很好。但我的OverlayView()对象出现了一个错误,无法修复。这只是谷歌文档中"自定义套印格式"的第一步,但它不起作用。

错误:"ReferenceError:MapSymbol未定义"

app.directive('map', function() {

var linkFunction = function(scope, element, attrs) {
    MapSymbol.prototype = new google.maps.OverlayView();
    var map;
    function initMap () {
        map = new google.maps.Map($('#map')[0], {
            center: {lat: -34.397, lng: 150.644},
            zoom: 3
    });
    }
    initMap();
};

return {
    link: linkFunction,
    templateUrl: 'app/templates/map.html'
};});

似乎你想玩谷歌地图。你可以使用这个http://angular-ui.github.io/angular-google-maps/以便于以角度加载地图。它启用了地图中的大部分功能。