2017-07-02 68 views
0

我在同一页面使用了两个组件,https://angular-maps.com和angular2-google-map-auto-complete。 https://www.npmjs.com/package/angular2-google-map-auto-complete。我定义在这条路上的角度映射键:Angular 2:Google Maps和Angular Google Places

AgmCoreModule.forRoot({ 
apiKey: 'API_KEY' 
}) 

而且对索引文件谷歌地图automplete:

<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

回答

0

just rem从您的index.html中删除

<script src="https://maps.googleapis.com/maps/api/js?key=API_KEY&libraries=places"></script> 

并在amgCoreModule声明中添加您的API密钥。

相关问题