I'm trying to set a custom marker on an AngularJS Google Map:
<google-map
draggable="true"
style="display:block; width: 100%; height:100%;">
<markers>
<marker ng-repeat="marker in markers" coords="marker" icon="../img/marker-map.png">
</marker>
</markers>
</google-map>
This code throws the following error:
Error: [$parse:syntax] Syntax Error: Token '.' not a primary expression at column 1 of the expression [../img/marker-map.png] starting at [../img/marker-map.png].
On the Angular Google Maps API documentation, in Marker directive's icon
parameter , it says:
Expression returning the absolute path to an image used as the marker icon
I think I misunderstood that statement. Isn't it possible to set a relative path for the marker icon image, as in the code example above? What could be an expression to reference the marker image?
I got it, on the marker directive's icon parameter I should use a variable that references the marker image.
HTML:
On my controller: