Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何更改信息窗口内不同标记的内容?_Javascript_Angular_Google Maps_Angular Google Maps_Agm - Fatal编程技术网

Javascript 如何更改信息窗口内不同标记的内容?

Javascript 如何更改信息窗口内不同标记的内容?,javascript,angular,google-maps,angular-google-maps,agm,Javascript,Angular,Google Maps,Angular Google Maps,Agm,我正在使用AGM(angular google maps)库处理angular。我不知道如何让每个标记的信息窗口内容不同。我希望每个标记都有自己的信息弹出。 这是我的component.html: <div class ="content"> <h2>Popular Locations around InComm</h2> <agm-map> [latitude]="latitude" [longitude]="longit

我正在使用AGM(angular google maps)库处理angular。我不知道如何让每个标记的信息窗口内容不同。我希望每个标记都有自己的信息弹出。 这是我的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>

任何帮助都会得到帮助,谢谢

用要替换的内容替换信息窗口内容。例如,如果要显示标签,只需添加
{{location.label}}

<agm-info-window #infowindow>
    <strong>{{location.label}}</strong>
  </agm-info-window>

</agm-marker>

{{location.label}}

用要替换的内容替换信息窗口内容。例如,如果要显示标签,只需添加
{{location.label}}

<agm-info-window #infowindow>
    <strong>{{location.label}}</strong>
  </agm-info-window>

</agm-marker>

{{location.label}}