2016-05-17 18:26:49 +03:00
|
|
|
import {Component, ElementRef} from '@angular/core';
|
2017-01-09 11:37:57 +03:00
|
|
|
import * as GoogleMapsLoader from 'google-maps';
|
2016-05-02 16:55:58 +03:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'google-maps',
|
2017-01-09 11:37:57 +03:00
|
|
|
styleUrls: ['./googleMaps.scss'],
|
|
|
|
|
templateUrl: './googleMaps.html',
|
2016-05-02 16:55:58 +03:00
|
|
|
})
|
|
|
|
|
export class GoogleMaps {
|
|
|
|
|
|
2016-05-02 17:43:45 +03:00
|
|
|
constructor(private _elementRef:ElementRef) {
|
2016-05-02 16:55:58 +03:00
|
|
|
}
|
|
|
|
|
|
2016-05-02 17:43:45 +03:00
|
|
|
ngAfterViewInit() {
|
2016-05-11 17:38:01 +03:00
|
|
|
let el = this._elementRef.nativeElement.querySelector('.google-maps');
|
2016-05-02 18:17:54 +03:00
|
|
|
|
2016-05-06 19:48:48 +03:00
|
|
|
// TODO: do not load this each time as we already have the library after first attempt
|
2016-05-02 17:43:45 +03:00
|
|
|
GoogleMapsLoader.load((google) => {
|
2016-05-02 18:17:54 +03:00
|
|
|
new google.maps.Map(el, {
|
2016-05-02 17:43:45 +03:00
|
|
|
center: new google.maps.LatLng(44.5403, -78.5463),
|
|
|
|
|
zoom: 8,
|
|
|
|
|
mapTypeId: google.maps.MapTypeId.ROADMAP
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-05-02 16:55:58 +03:00
|
|
|
}
|