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 Failed to load resource: the server responded with a status of 404 (Not Found)

但我可以在 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