Javascript 如何在Angular 2中显示Google地图上的标记?
我在一个弹出窗口中显示地图,借助于纬度和经度动态显示。但是,“地图”设置在弹出窗口中的正确位置。我无法在地图上显示标记。我可以知道如何做到这一点吗 下面是HTML代码Javascript 如何在Angular 2中显示Google地图上的标记?,javascript,angular,google-maps,typescript,google-maps-api-3,Javascript,Angular,Google Maps,Typescript,Google Maps Api 3,我在一个弹出窗口中显示地图,借助于纬度和经度动态显示。但是,“地图”设置在弹出窗口中的正确位置。我无法在地图上显示标记。我可以知道如何做到这一点吗 下面是HTML代码 <div class="mapIcon" (click)="open($event)"><i class="fa fa-location-arrow" aria-hidden="true"></i></div> <modal [animation]="animationsEn
<div class="mapIcon" (click)="open($event)"><i class="fa fa-location-arrow" aria-hidden="true"></i></div>
<modal [animation]="animationsEnabled" (onClose)="onClose($event)" #modal>
<modal-header [show-close]="true">
<h4 class="modal-title">Components</h4>
</modal-header>
<modal-body class="slider-bar">
<div>
<ngui-map zoom="{{zoom}}" center="{{lat}}, {{lng}}"
(mapReady$)="onMapReady($event)" (mapClick)="onMapClick($event)"
(idle)="onIdle($event)">
<marker [geoFallbackPosition]="[lat, lng]"
(initialized$)="onMarkerInit($event)"></marker>
</ngui-map>
</div>
</modal-body>
<modal-footer>
</modal-footer>
</modal>
我想在位置上显示标记。有关于我的代码的帮助吗?尝试在标记上设置
[position]
属性
export class Maps{
lat: any;
lng: any;
onMapReady(map) {
console.log('map', map);
console.log('markers', map.markers);
}
onIdle(event) {
console.log('map', event.target);
}
onMarkerInit(marker) {
console.log('marker', marker);
}
onMapClick(event) {
this.positions.push(event.latLng);
event.target.panTo(event.latLng);
}
open(e) {
this.lat = "17.419279";
this.lng = "78.337095";
this.modal.open('lg');
}
}