【发布时间】:2019-02-15 17:52:38
【问题描述】:
我目前正在开发一个使用 Google 地图的 Angular2 项目。
我正在尝试在该区域周围显示标记和多个标记。 我的地图工作正常,但似乎无法标记。
<div class="google-maps"></div>
constructor(private _elementRef:ElementRef) {
}
ngAfterViewInit() {
let el = this._elementRef.nativeElement.querySelector('.google-maps');
GoogleMapsLoader.load((google) => {
let myLatlng = new google.maps.LatLng(44.5403,-78.5463);
new google.maps.Map(el, {
center: new google.maps.LatLng(44.5403, -78.5463),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
new google.maps.Marker(el,{
draggable: true,
animation: google.maps.Animation.DROP,
position: myLatlng,
title:"Hello World!"
});
});
}
【问题讨论】:
-
记录了任何错误?
-
希望这个链接能帮到你stackoverflow.com/questions/3059044/…
-
无错误日志按摩
标签: google-maps angular typescript