我已经用angular2-google-map应用程序设置了angular2。
这是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地图,
npm install angular2-google-maps --save安装成功了。当我使用npm运行应用程序时,它会显示一个错误:
http://localhost:3000/angular2-google-maps/core未能加载资源:服务器响应状态为404 (未找到)
但是我可以看到angular2-google-maps文件夹在node_modules中。有什么问题吗?
发布于 2017-01-25 05:50:15
您忘了在map中添加system.config.js
'angular2-google-maps/core': 'npm:angular2-google-maps/core/core.umd.js'通过将上面添加到systemjs配置中。当您尝试导入core.umd.js时,模块加载器将理解加载angular2-google-maps/core。
https://stackoverflow.com/questions/41844243
复制相似问题