2016-05-02 17:43:45 +03:00
|
|
|
import {Component, ViewEncapsulation, ElementRef} from 'angular2/core';
|
2016-05-04 11:49:36 +03:00
|
|
|
import {BaCard} from '../../../../theme/components';
|
2016-05-02 17:43:45 +03:00
|
|
|
import {DOM} from "angular2/src/platform/dom/dom_adapter";
|
2016-05-02 16:55:58 +03:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'google-maps',
|
|
|
|
|
pipes: [],
|
|
|
|
|
providers: [],
|
2016-05-02 17:43:45 +03:00
|
|
|
styles: [require('./googleMaps.scss')],
|
|
|
|
|
directives: [BaCard],
|
|
|
|
|
template: require('./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-02 18:17:54 +03:00
|
|
|
let el = DOM.querySelector(this._elementRef.nativeElement, '.google-maps');
|
|
|
|
|
|
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
|
|
|
}
|