简体   繁体   中英

angular2-google-maps with angular2 app

I have setup the angular2-google-map with angular2 application.

And here is the 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 { }

And i installed the angular2-google-maps with the command,

npm install angular2-google-maps --save

which got successfully installed. when i run the application with npm start, it shows an error saying,

http://localhost:3000/angular2-google-maps/core Failed to load resource: the server responded with a status of 404 (Not Found)

but i can see the angular2-google-maps folder inside the node_modules. what is the issue?

You forgotten to add map for in system.config.js

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

By adding above to systemjs configuration. Module loader will understand to load core.umd.js when you tries to import angular2-google-maps/core .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM