google-map icon indicating copy to clipboard operation
google-map copied to clipboard

google-map markers property is not notifying

Open thexs-dev opened this issue 8 years ago • 2 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

thexs-dev avatar May 11 '16 13:05 thexs-dev

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

On Wed, May 11, 2016, 6:04 AM Fausto-theXS [email protected] 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 https://github.com/GoogleWebComponents/google-map/issues/297

ebidel avatar May 11 '16 15:05 ebidel

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?

thexs-dev avatar May 11 '16 17:05 thexs-dev