Skip to content

Google map marker: doesn't update InfoWindow when stamped using map attribute binding #286

@tst-dhudlow

Description

@tst-dhudlow

The example code for displaying google search results is this:

<template is="dom-bind">
  <google-map-search map="[[map]]" query="Pizza" results="{{results}}">
  </google-map-search>
  <google-map map="{{map}}" latitude="37.779"
              longitude="-122.3892">
    <template is="dom-repeat" items="{{results}}" as="marker">
      <google-map-marker latitude="{{marker.latitude}}"
                         longitude="{{marker.longitude}}">
        <h2>{{marker.name}}</h2>
        <span>{{marker.formatted_address}}</span>
      </google-map-marker>
    </template>
  </google-map>
</template>

This works, but if you want to use the map binding outside the google-map element instead like this:

<template is="dom-bind">

  <google-map-search map="[[map]]" query="Pizza" results="{{results}}">
  </google-map-search>

  <template is="dom-repeat" items="{{results}}" as="marker">
    <google-map-marker map="{{map}}"
                       latitude="{{marker.latitude}}"
                       longitude="{{marker.longitude}}">
      <h2>{{marker.name}}</h2>
      <span>{{marker.formatted_address}}</span>
    </google-map-marker>
  </template>

  <google-map map="{{map}}" latitude="37.779"
              longitude="-122.3892">
  </google-map>
</template>

The InfoWindow doesn't have the resolved bindings. Instead, it has empty h2 and span tags. This has to due with the order of operations. One-line PR coming soon that fixes it. May not be the right solution, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions