无法获得google-maps-directions聚合物元素工作

时间:2015-10-19 21:13:17

标签: google-maps polymer

我一直在尝试在我的应用中使用google-map-directions元素。这是代码:

<google-map map="{{map}}" latitude="37.779" 
  longitude="-122.3892" zoom="13" disable-default-ui>
</google-map>

<google-map-directions map="{{map}}" 
  start-address="San Francisco"
  end-address="Mountain View"></google-map-directions>

我在控制台中收到此错误:

Uncaught TypeError: window.google.maps.Load is not a function

我该怎么做才能解决这个问题?

1 个答案:

答案 0 :(得分:0)

是的,我包括两者,这里是元素完成:

<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../google-map/google-map-directions.html">

<dom-module id="mapa-direccion" >
<style>
   google-map {
    display: block;
    width: 50%;
    height: 50%;
}
</style>
<template is="dom-bind">
    <google-map id='s' map="{{map}}" latitude="37.779" longitude="-122.3892"></google-map>
        <google-map-directions map="{{map}}"
            startaddress="San Francisco"
            endaddress="Mountain View"
            travel-mode="TRANSIT">
    </google-map-directions>
</template>

<script>
    Polymer({
        is: "mapa-direccion",
    });
</script>
</dom-module>