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

最新更新