0

我建立一個車輛跟蹤應用程序和我使用AGM-MAP-標記來顯示分別位於這樣的圖像,所述車輛, enter image description here如何在agm-map中製作自定義箭頭標記?

而且Livetracking.component.html代碼是,

<agm-map #gm [latitude]="lat" [longitude]="lng" [(zoom)]="zoom" [mapTypeControl]="true"> 
      <agm-marker class="mapMarker" *ngFor="let device of devices;" 
       [latitude]="device.latitude" [longitude]="device.longitude" 
       (markerClick)="gm.lastOpen?.close(); gm.lastOpen = infoWindow;mapMarkerInfo(m);"> 
      </agm-marker> 
</agm-map> 

在這裏,我需要更換標記爲箭頭,正是因爲這樣的形象中,

enter image description here

我在需要改變的標記箭頭在第二image..Kindly像幫助我達到理想的結果..

回答

1

您可以使用現有的API,並設置iconUrl

<agm-marker 
    [latitude]="location.latitude" 
    [longitude]="location.longitude" 
    [iconAnchorX]="10" 
    [iconAnchorY]="10" 
    [iconHeight]="20" 
    [iconWidth]="20"> 
    [iconUrl]="location.icon"> 
</agm-marker> 
+0

感謝您的幫助。 。 –

+0

我收到錯誤'無法綁定到'iconAnchorX',因爲它不是'agm-marker'.'的已知屬性,當我添加上面的代碼時 – harish

相關問題