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

Failed to bind `api-key` attribute with data-binding instead of static value

andrewspy opened this issue · comments

Setting the API Key with Polymer data-binding as below gives me error:-

<google-map id="map"
  api-key="[[appconfig.googleMapApiKey]]">
</google-map>

I have tested it with static API Key with no issue, below is the error given by chrome:-

google-maps-api.html:130 No Google Maps API Key or Client ID specified. See https://developers.google.com/maps/documentation/javascript/get-api-key for instructions to get started with a key or client id.

You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys

Using the <dom-if> seems to resolve the issue:

<template is"dom-if" if="[[appconfig.googleMapApiKey]]">
  <google-map id="map"
    api-key="[[appconfig.googleMapApiKey]]">
  </google-map>
</template>

Closing the issue.