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

google-map markers property is not notifying

thexs-dev opened this issue · comments

When using a sample code as below

<google-map map="{{map}}" markers="{{markers}}">
  <template is="dom-repeat" items="{{locations}}">
    <google-map-marker latitude="{{item.latitude}}" longitude="{{item.longitude}}">
    </google-map-marker>
  </template>
</google-map>

markers changes are not visible outside google-map element, it always returns undefined

Just by adding notify:true within google-map element, markers property becomes available outside google-map element.

markers: {
        type: Array,
        value: function() { return []; },
        notify: true,
        readOnly: true
      },

Could you please, fix or report this issue to be fixed?
Thanks

What's the use case for notifying markers? Every property that notifies
hurts perf.

On Wed, May 11, 2016, 6:04 AM Fausto-theXS notifications@github.com wrote:

When using a sample code as below

markers changes are not visible outside google-map element, it always
returns undefined

Just by adding notify:true within google-map element, markers property
becomes available outside google-map element.

markers: {
type: Array,
value: function() { return []; },
notify: true,
readOnly: true
},

Could you please, fix or report this issue to be fixed?
Thanks


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#297

That's a good point

It's probably due to my still limited understanding. This is my use case:

  • I have a filter in the dom-repeat, that allows for hide/show locations in the map, depending on user interaction.
  • I need to work with the filtered array (subset of locations), and I am not aware of an easy way of having access to that filtered array. That's the reason I'd use markers
  • But, If I'd knew how to access the filtered array (corresponding with locations showing in the map), then I won't need to use markers, I guess

Any option for having that instead of markers?