如何在angular-google-maps指令中组合RichMarker

时间:2013-11-30 23:02:36

标签: google-maps angularjs angularjs-directive

有谁知道如何在angular-google-maps指令中组合RichMarker?

祝你好运, 陈

2 个答案:

答案 0 :(得分:1)

由于一些哲学上的差异,我创建了ng-map

使用ng-map非常容易。看起来像这样

  var app = angular.module("myApp", ["ngMap"]);

  app.controller("MyController", function($scope) {
    $scope.$on('mapInitialized', function(evt, map) {
      new RichMarker({
        map: map,   // !! $scope.map
        position: new google.maps.LatLng(40.80, -74.13),
        draggable: true,
        flat: true,
        anchor: RichMarkerPosition.MIDDLE,
        content: '<img src="http://farm4.static.flickr.com/3212/3012579547_097e27ced9_m.jpg"/>'
      });  
    });
  });

http://plnkr.co/edit/XOY25pFzd8OnzloPvACn?p=preview

有关ngmap的更多信息,请访问http://ngmap.github.io

答案 1 :(得分:0)

  1. 使富标记库成为角度模块。并将工厂命名为RichMarker
  2. 创建一个指令并传递包含要显示给该指令的信息的元素。也在这里通过RichMarker工厂。只需创建标记。