角度Google地图自定义标记图标

问题描述:

我无法创建自定义标记。即使我传递一个图像路径到图标参数,我仍然得到默认的橙色标记。 请告诉我,如果你看到任何错误。角度Google地图自定义标记图标

指令的模板:

<div id="searchMap" class="googleMaps-destinations"> 
<div class="google-maps"> 
    <ui-gmap-google-map center="map.center" zoom="map.zoom" options="map.options"> 
     <ui-gmap-marker 
      ng-repeat="marker in search.origin_airports" 
      coords="marker.originMarker.location" 
      icon="marker.originMarker.icon.url" 
      fit="false" 
      idkey="'<<marker.originMarker.id>>'" > 
     </ui-gmap-marker> 
    </ui-gmap-google-map> 
</div> 

我使用://maps.googleapis.com/maps/api/js?v=3 &传感器=与真正的角google- maps/dist/angular-google-maps.js

+0

我只注意到我不能用动画为好。 – JKoder 2015-04-01 19:06:28

错过了该图标是一个对象。

icon= '{url: "//developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png" }' 
+0

工作。但我不认为这是什么医生说http://angular-ui.github.io/angular-google-maps/#!/api – Toolkit 2015-05-15 04:38:12

我解决了在控制器通过图标的网址通过选项属性

设置这样的事情

marker.options: { 
    icon:'//developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png"' 
} 

然后

<div id="searchMap" class="googleMaps-destinations"> 
    <div class="google-maps"> 
    <ui-gmap-google-map center="map.center" zoom="map.zoom" options="map.options"> 
    <ui-gmap-marker 
     options="marker.options" 
     ng-repeat="marker in search.origin_airports" 
     coords="marker.originMarker.location"  
     fit="false" 
     idkey="'<<marker.originMarker.id>>'"> 
    </ui-gmap-marker> 
</ui-gmap-google-map> 

+0

看起来像这个问题,必须通过选项哈希设置图标,已有报道:https://github.com/angular-ui/angular-google-maps/issues/1408 – ecbrodie 2015-08-16 19:19:53

我含有S olved自定义图标问题 请与plunkerClick here

options: { draggable: false,  icon:'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png' } 

HTML是这里

<ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="options"> 
     <ui-gmap-marker coords="marker.coords" options="marker.options" events="marker.events" idkey="marker.id"> 
     </ui-gmap-marker> 
    </ui-gmap-google-map>