Skip to content

Instantly share code, notes, and snippets.

@deebloo
Created January 28, 2018 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deebloo/8002dbf045153ec19d020b882f78ede2 to your computer and use it in GitHub Desktop.
Save deebloo/8002dbf045153ec19d020b882f78ede2 to your computer and use it in GitHub Desktop.
import { Component, ViewChild, ElementRef, AfterViewInit } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<div class="map-container" #mapContainer><div>
`,
styles: [`
.map-container {
height: 300px;
}
`]
})
export class AppComponent implements AfterViewInit {
@ViewChild('mapContainer') map: ElementRef;
private mapRef: google.maps.Map;
ngAfterViewInit() {
this.mapRef = new google.maps.Map(this.map.nativeElement, {
zoom: 16,
center: {
lat: 38.9072,
lng: 77.0369
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment