Replace @agm/core with @angular/google-maps

This commit is contained in:
eugene-sinitsyn 2020-03-03 17:23:14 +03:00
parent 88020acd3e
commit 398c8c2a87
6 changed files with 34 additions and 22 deletions

View file

@ -0,0 +1,8 @@
<nb-card>
<nb-card-header>Google Maps</nb-card-header>
<nb-card-body>
<google-map [center]="position" [zoom]="8" width="100%" height="36.5625rem">
<map-marker [position]="position"></map-marker>
</google-map>
</nb-card-body>
</nb-card>

View file

@ -3,19 +3,8 @@ import { Component } from '@angular/core';
@Component({
selector: 'ngx-gmaps',
styleUrls: ['./gmaps.component.scss'],
template: `
<!-- <nb-card>
<nb-card-header>Google Maps</nb-card-header>
<nb-card-body>
<agm-map [latitude]="lat" [longitude]="lng">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map>
</nb-card-body>
</nb-card> -->
`,
templateUrl: './gmaps.component.html'
})
export class GmapsComponent {
lat = 51.678418;
lng = 7.809007;
public readonly position = { lat: 51.678418, lng: 7.809007 };
}

View file

@ -1,5 +1,5 @@
import { NgModule } from '@angular/core';
// import { AgmCoreModule } from '@agm/core';
import { GoogleMapsModule } from '@angular/google-maps';
import { LeafletModule } from '@asymmetrik/ngx-leaflet';
import { NgxEchartsModule } from 'ngx-echarts';
import { NbCardModule } from '@nebular/theme';
@ -10,10 +10,7 @@ import { MapsRoutingModule, routedComponents } from './maps-routing.module';
@NgModule({
imports: [
ThemeModule,
// AgmCoreModule.forRoot({
// apiKey: 'AIzaSyCpVhQiwAllg1RAFaxMWSpQruuGARy0Y1k',
// libraries: ['places'],
// }),
GoogleMapsModule,
LeafletModule.forRoot(),
MapsRoutingModule,
NgxEchartsModule,

View file

@ -9,6 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="favicon.png">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCpVhQiwAllg1RAFaxMWSpQruuGARy0Y1k"></script>
</head>
<body>
<ngx-app>Loading...</ngx-app>