title: Ionic 2 Google Maps:: Uncaught (in promise): TypeError: Cannot read property 'firstChild' of null
body: <p>I'm using ionic 2 and trying to load google map using its JS API.
  Here is my code:</p>
  
  <pre><code>import { Component, ViewChild, ElementRef } from '@angular/core';
  import { NavController, Platform, NavParams } from 'ionic-angular';
  declare var google;
  
  @Component({
    selector: 'page-map',
    templateUrl: 'map.html',
  })
  export class MapPage {
  
    @ViewChild('map') mapElement: ElementRef;
    map: any;
    latitude : any;
    longitude : any;
  
    constructor(public platform: Platform, public navCtrl: NavController,public navParams: NavParams) {   
  
      this.platform = platform;    
      this.initializeMap();
    }
  
    ionViewDidLoad(){
      this.initializeMap();
    }  
  
    initializeMap() {    
         this.platform.ready().then(() =&gt; {
         var minZoomLevel = 12;
  
         this.map = new google.maps.Map(document.getElementById('map'), {
             zoom: minZoomLevel,
             center: new google.maps.LatLng(38.50, -90.50),
             mapTypeId: google.maps.MapTypeId.ROADMAP
         });
  
         var position = new google.maps.LatLng("23.032612699999998", "72.56187790000001");
         var dogwalkMarker = new google.maps.Marker({position: position, title: "Testing"});
         dogwalkMarker.setMap(this.map);
     });
  
     } 
  
  }
  </code></pre>
  
  <p>I have also added reference of the JS in my index.html file before cordova.js:</p>
  
  <pre><code>&lt;script src="http://maps.google.com/maps/api/js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Here is my html:</p>
  
  <pre><code>&lt;ion-header&gt;
    &lt;ion-navbar hideBackButton side="left"&gt;  
      &lt;ion-title  style="margin-left: 0px;"&gt;&lt;span class="menuTitle"&gt;Map&lt;/span&gt;&lt;/ion-title&gt;    
    &lt;/ion-navbar&gt;
  
   &lt;/ion-header&gt;
  
  &lt;ion-content&gt;
    &lt;div #map id="map"&gt;&lt;/div&gt;
  &lt;/ion-content&gt;
  </code></pre>
  
  <p>The code does not display any error but when I try to load this page it displays error like: </p>
  
  <p><strong>Uncaught (in promise): TypeError: Cannot read property 'firstChild' of null</strong></p>