Uncaught (in promise):
TypeError: Cannot read property 'firstChild' of null TypeError: Cannot read property 'firstChild' of null at Object._.og (maps.googleapis.com/maps/api/js?key=&callback=initMap:88:391) at new tg (maps.googleapis.com/maps/api/js?key=&callback=initMap:90:76) at ParkMapPage.initializeMap
Above Error when I try ionic serve --lab
import { Component } from '@angular/core';
import { Platform, NavController } from 'ionic-angular';
@Component({
selector: 'page-park-map',
templateUrl: 'park-map.html'
})
export class ParkMapPage {
map: google.maps.Map;
constructor(public navCtrl: NavController, public platform: Platform) {
this.map = null;
this.platform.ready().then(() => {
this.initializeMap();
});
}
initializeMap() {
let minZoomLevel = 3;
this.map = new google.maps.Map(document.getElementById("map_canvas"), {
zoom: minZoomLevel,
center: {lat: 39.833, lng: -98.583},
mapTypeControl: false,
streetViewControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
}
}
Above is my code in Typescript file.
<ion-content>
<div id="map_canvas"></div>
</ion-content>
Above is my code in HTML file.
This is an exercise from a book. I can't solve it, can anyone please help me ):