我正在使用 AGM(角度谷歌地图)库处理角度。我不知道如何让每个标记的信息窗口内容不同。我希望每个标记都有自己的信息弹出。这是我的 component.html :
<div class ="content">
<h2>Popular Locations around InComm</h2>
<agm-map>
[latitude]="latitude"
[longitude]="longitude"
[zoom]="zoom" >
<agm-marker *ngFor="let location of locations"
[latitude]= "location.latitude"
[longitude] ="location.longitude"
[label]= "location.label"
(markerClick)="clickedMarker(infowindow)"
>
<agm-info-window #infowindow>
<strong>InfoWindow content</strong>
</agm-info-window>
</agm-marker>
</agm-map>
</div>
这是我的 component.ts :
previous;
clickedMarker(infowindow) {
if (this.previous) {
this.previous.close();
}
this.previous = infowindow;
}
markerDragEnd(m: location, $event: MouseEvent) {
console.log('dragEnd', m, $event);
}
任何帮助将不胜感激,谢谢!