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

_setMarkers not defined

cmalagar opened this issue · comments

Hi,

Someone correct if I am overlooking something, but it looks like the "markers" attribute is not getting populated with the current markers added on the page. The markers should be set in _updateMarkers where _setMarkers(newMarkers) is called, but that function is not set anywhere and the markers attribute still returns an empty list of markers when that attribute is referenced.

Hello @cmalagar,

I was having the same problem until I figured you have to declare the google-map-marker as:

<google-map-marker slot="markers" draggable="true" latitude="whatever" longitude="whatever"></google-map-marker>

Notice the slot="markers" property. After that, my markers array is populated. You can see it in commit 361d389
This was the issue for me, at least.

Have a good one.

Thanks for figuring this out! Note this solution appears to need #354 to be merged in to work, otherwise you get this error:

Uncaught TypeError: Cannot set property markers of #<google-map> which has only a getter