谷歌地图市场指令

时间:2015-11-09 20:38:03

标签: javascript angularjs google-maps

我试图为标记创建指令。

    angular.module("App").directive('marker', function () {
      var marker = new google.maps.Marker({
        map: map.map,
        position: new google.maps.LatLng(48.6908333333, 9.14055555556),
        title: 'Marker'
      });

      marker.setMap(map.map);
      return {
        restrict: 'E',
        scope: {
          map: '=map'
        },
        template: '{{marker}}'
     };
    });

我在控制器内初始化了Google地图。

var map = new google.maps.Map(document.getElementById("map"), myOptions);

和HTML:

<marker map="map"></marker>

映射加载但标记没有。

0 个答案:

没有答案