【发布时间】:2021-11-25 15:46:31
【问题描述】:
我想让它在谷歌地图上标出想要的地方,我该怎么做?
<google-map id="map-container" width="100%" height="100%" class="maps"></google-map>
【问题讨论】:
标签: html css angular typescript
我想让它在谷歌地图上标出想要的地方,我该怎么做?
<google-map id="map-container" width="100%" height="100%" class="maps"></google-map>
【问题讨论】:
标签: html css angular typescript
你可以像这样在angular中添加它:
<google-map>
<map-marker
*ngFor="let marker of markers"
[position]="marker.position"
[label]="marker.label"
[title]="marker.title"
[options]="marker.options"
>
</map-marker>
</google-map>
// Add to list like this way
this.markers.push({
position: {
lat: latitudeValue,
lng: longitudeValue,
},
label: {
color: 'red',
text: 'Marker label ' + (this.markers.length + 1),
},
title: 'Marker title ' + (this.markers.length + 1),
options: { animation: google.maps.Animation.BOUNCE },
});
【讨论】: