title: Ionic 2 google maps marker click
body: <p>I have a map with one marker and when I click the marker I want the name to be shown in the toolbar. When I click the console.log show the correct value but nothing updates in the toolbar. But if I click the marker and change the tab and goes back it works.</p>
  
  <pre><code>import { Component, ViewChild, ElementRef } from '@angular/core';
  import { NavController } from 'ionic-angular';
  declare var google;
  @Component({
    selector: 'page-home',
    templateUrl: 'home.html'
  })
  export class HomePage {
    @ViewChild('map') mapElement: ElementRef;
    map: any;
    name: string = "";
    constructor(public navCtrl: NavController) {
    }
    ionViewDidLoad() {
      this.initializeMap();
    }
    initializeMap() {
      let letLng = new google.maps.LatLng(62.3908, 17.3069);
      let mapOptions = {
        center: letLng,
        zoom: 7,
        mapTypeId: google.maps.MapTypeId.HYBRID
      }
      this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
      this.addMarker();
    }
    addMarker() {
      let marker = new google.maps.Marker({
        map: this.map,
        animation: google.maps.Animation.DROP,
        position: { lat: 62.3908, lng: 17.3069 },
        title: 'Kalle'
      })
      let content = `&lt;h1&gt;Kalle&lt;/h1&gt;`;
      this.addInfoWindow(marker, content);
    }
    addInfoWindow(marker, content) {
      let infoWindow = new google.maps.InfoWindow({
        content: content
      });
      google.maps.event.addListener(marker, 'click', () =&gt; {
        this.name = marker.title;
        infoWindow.open(this.map, marker)
      })
    }
    change() {
      this.name = "Patrik";
    }
  }
   &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;HTML&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&lt;
  &lt;ion-header&gt;
    &lt;ion-navbar&gt;
      &lt;ion-title&gt;{{name}}&lt;/ion-title&gt;
      &lt;button ion-button (click)="change()"&gt;Clcik&lt;/button&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>