Skip to content

Commit 271ab77

Browse files
crisbetommalerba
authored andcommitted
build: google maps dev app not working in Edge and IE (#17459)
It seems like loading the Google Maps API through JSNOP wasn't working under IE and Edge in the dev app. These changes switch to loading the API through a `script` tag instead.
1 parent db283f1 commit 271ab77

File tree

4 files changed

+2
-15
lines changed

4 files changed

+2
-15
lines changed

src/dev-app/google-map/google-map-demo-module.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
import {CommonModule} from '@angular/common';
10-
import {HttpClientJsonpModule, HttpClientModule} from '@angular/common/http';
1110
import {NgModule} from '@angular/core';
1211
import {GoogleMapsModule} from '@angular/google-maps';
1312
import {RouterModule} from '@angular/router';
@@ -18,8 +17,6 @@ import {GoogleMapDemo} from './google-map-demo';
1817
imports: [
1918
CommonModule,
2019
GoogleMapsModule,
21-
HttpClientJsonpModule,
22-
HttpClientModule,
2320
RouterModule.forChild([{path: '', component: GoogleMapDemo}]),
2421
],
2522
declarations: [GoogleMapDemo],

src/dev-app/google-map/google-map-demo.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<google-map *ngIf="isReady"
2-
height="400px"
1+
<google-map height="400px"
32
width="750px"
43
[center]="center"
54
[zoom]="zoom"

src/dev-app/google-map/google-map-demo.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {HttpClient} from '@angular/common/http';
109
import {Component, ViewChild} from '@angular/core';
1110
import {MapInfoWindow, MapMarker} from '@angular/google-maps';
1211

@@ -19,22 +18,13 @@ import {MapInfoWindow, MapMarker} from '@angular/google-maps';
1918
export class GoogleMapDemo {
2019
@ViewChild(MapInfoWindow, {static: false}) infoWindow: MapInfoWindow;
2120

22-
isReady = false;
23-
2421
center = {lat: 24, lng: 12};
2522
markerOptions = {draggable: false};
2623
markerPositions: google.maps.LatLngLiteral[] = [];
2724
infoWindowPosition: google.maps.LatLngLiteral;
2825
zoom = 4;
2926
display?: google.maps.LatLngLiteral;
3027

31-
constructor(httpClient: HttpClient) {
32-
httpClient.jsonp('https://maps.googleapis.com/maps/api/js?', 'callback')
33-
.subscribe(() => {
34-
this.isReady = true;
35-
});
36-
}
37-
3828
handleClick(event: google.maps.MouseEvent) {
3929
this.markerPositions.push(event.latLng.toJSON());
4030
}

src/dev-app/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<script src="systemjs/dist/system.js"></script>
3131
<script src="system-config.js"></script>
3232
<script src="https://www.youtube.com/iframe_api"></script>
33+
<script src="https://maps.googleapis.com/maps/api/js"></script>
3334
<script>
3435
// Workaround until https://github.com/angular/components/issues/13883 has been addressed.
3536
var module = {id: ''};

0 commit comments

Comments
 (0)