簡體   English   中英

angular2-google-maps with angular2 app

[英]angular2-google-maps with angular2 app

我已經使用angular2應用程序設置了angular2-google-map

這是app.module.ts

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent }  from './app.component';
import { AgmCoreModule} from 'angular2-google-maps/core';
@NgModule({
  imports:      [ BrowserModule, AgmCoreModule.forRoot({apiKey: 'AIzaSyAe3ci9yavJcWt7MaJE8DusAuZo-QeRqkU'}) ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ],
})
export class AppModule { }

我用命令安裝了angular2-google-maps,

npm install angular2-google-maps --save

哪個成功安裝。 當我用npm start運行應用程序時,它顯示錯誤說,

http:// localhost:3000 / angular2-google-maps / core無法加載資源:服務器響應狀態為404(未找到)

但我可以在node_modules中看到angular2-google-maps文件夾。 問題是什么?

您忘記在system.config.js添加map

'angular2-google-maps/core': 'npm:angular2-google-maps/core/core.umd.js'

通過將以上內容添加到systemjs配置中。 當您嘗試導入angular2-google-maps/core時,模塊加載器將理解加載core.umd.js

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM