2017-07-02 3 views
0

同じページ内に2つのコンポーネント(https://angular-maps.comとangular2-google-map-auto-complete)を使用しています。 https://www.npmjs.com/package/angular2-google-map-auto-complete。私はこのように角度マップキーを定義します。角2:Googleマップと角型Googleプレイス

インデックスファイルに
AgmCoreModule.forRoot({ 
apiKey: 'API_KEY' 
}) 

とGoogleマップ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. 

私はホイエラー

答えて

0

をちょうどレム避けるために、単一のAPI_KEYを定義し、問題が何であるかを知っているが、あなたのindex.htmlから

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

を追加し、apiキーをamgCoreModule宣言の中に追加してください。

関連する問題