@angular/谷歌地图更改标记颜色



我正在为Angular使用谷歌地图,但我找不到如何更改标记的颜色。我有不同的坐标,我想分别给每个坐标上色。

目前我使用的是:

const marker = {
position: {
lat: parseFloat(site.lat),
lng: parseFloat(site.lng),
},
icon: "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png",
id: site.id,
title: site.address,
label: {
color: 'red',
text: site.contractCode,
}
};

我试图将一个具有url属性的对象传递给icon,并传递一个字符串,但都不起作用。

提前感谢

你能使用:吗

<map-marker class="markerR" #marker="mapMarker" *ngFor="let unaalerta of listado"
[position]="unaalerta.Marker"
[options]="{icon: { url:'assets/images/{{unaalerta.icono}}' }, zIndex: 100}"

最新更新