Created
January 28, 2018 20:43
-
-
Save deebloo/8002dbf045153ec19d020b882f78ede2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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