【发布时间】:2017-07-02 04:17:35
【问题描述】:
我在同一页面中使用了两个组件,https://angular-maps.com 和 angular2-google-map-auto-complete。 https://www.npmjs.com/package/angular2-google-map-auto-complete。我以这种方式定义了角度映射键:
AgmCoreModule.forRoot({
apiKey: 'API_KEY'
})
对于索引文件上的谷歌地图自动完成:
<script src="https://maps.googleapis.com/maps/api/js?key=API_KEY&libraries=places"></script>
问题是当我在同一页面上使用该组件时会抛出错误
You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
我知道问题出在哪里,但请定义单个 API_KEY 以避免错误
【问题讨论】:
标签: javascript angular google-maps api-key