title: Modify sebm-google-map-marker using an angular2 directive
body: <p>I'm using angular2-google-maps <a href="https://angular-maps.com/" rel="nofollow noreferrer">https://angular-maps.com/</a> to build a google map with markers. What I'm trying to achieve is creating a marker which is customised with an users social media profile pic. I am going to use this: <a href="https://stackoverflow.com/questions/23965161/js-maps-v3-custom-marker-with-user-profile-picture">JS Maps v3: custom marker with user profile picture</a></p>
  
  <p>To do this, i need to modify the marker code which i cannot access. </p>
  
  <p><strong>Template:</strong> </p>
  
  <pre><code>&lt;sebm-google-map-marker
    [latitude]="lat"
    [longitude]="lon"
    [appSocialMediaGoogleMapMarker]="'assets/img/temp/profile-image.png'"
    &gt;
  &lt;/sebm-google-map-marker&gt;
  </code></pre>
  
  <p><strong>directive.ts</strong></p>
  
  <pre><code>import { Directive, ElementRef, Input } from '@angular/core';
  import { GoogleMapsAPIWrapper, MarkerManager, SebmGoogleMapMarker } from 'angular2-google-maps/core';
  
  @Directive({
    selector: '[appSocialMediaGoogleMapMarker]'
  })
  export class SocialMediaGoogleMapMarkerDirective {
    @Input('appSocialMediaGoogleMapMarker') socialMediaImage: string;
  
    constructor(
      el: ElementRef,
      private gmapsApi: GoogleMapsAPIWrapper,
      private markerManager: MarkerManager
    ) {
  
      this.gmapsApi.getNativeMap().then(map =&gt; {
        this.markerManager.getNativeMarker(el.nativeElement).then(marker =&gt; {
  
        });
      });
  
      console.log(this.socialMediaImage);
  
    }
  }
  </code></pre>
  
  <p>The error i'm getting is </p>
  
  <pre><code>Uncaught (in promise): TypeError: Cannot read property 'then' of undefined
  TypeError: Cannot read property 'then' of undefined
  </code></pre>
  
  <p>which is occuring on this line:</p>
  
  <pre><code>this.markerManager.getNativeMarker(el.nativeElement).then(marker =&gt; {
  </code></pre>
  
  <p>Also <code>this.socialMediaImage</code> if undefined.</p>
  
  <p>Any help would be great, thanks. </p>