Angular Google maps custom marker icon

JKoder picture JKoder · Apr 1, 2015 · Viewed 20k times · Source

I cannot create a custom marker. Even though I am passing an image path to the icon parameter I am still getting the default orange marker. Please tell me if you see anything wrong.

Directive's template:

<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>

I am using : //maps.googleapis.com/maps/api/js?v=3&sensor=true with angular-google-maps/dist/angular-google-maps.js

Answer

JKoder picture JKoder · Apr 1, 2015

Missed that icon is an object.

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