我的指令“map”中存在命名空间问题,因为mapInit()函数运行良好。但是我的OverlayView()对象出错了,无法修复它。这只是“自定义叠加层”的Google文档的第一步,但它不起作用。
错误:“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'
};});
答案 0 :(得分:0)
似乎您想要使用谷歌地图。您可以使用此http://angular-ui.github.io/angular-google-maps/更方便地以角度加载地图。它启用了大多数已启用的功能。