GoogleWebComponents / google-map

Google Maps web components

Home Page:https://elements.polymer-project.org/elements/google-map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

icon property broken in google-map-marker

dougchestnut opened this issue · comments

If I use a google-map-marker with an icon attribute set as a string like so:

<google-map-marker icon="https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png"></google-map-marker>

I get a marker but the icon used is the generic/default icon used. If I inspect the google-map-marker element I see the icon attribute in the dom but the element's icon property is not set (set to undefined).

If I change the type of the icon property in google-map-marker from Object to String then the icon works. I suppose this breaks the other supported types of icons however (google.maps.Icon|google.maps.Symbol).

          /**
           * Image URL for the marker icon.
           *
           * @type string|google.maps.Icon|google.maps.Symbol
           */
          icon: {
            type: String,
            value: null,
            observer: '_iconChanged'
          },

So I figured out that in 2.0 an attribute typed as an Object must be in JSON format.
This works:

<google-map-marker icon='"https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png"'></google-map-marker>