Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to style agm-marker label

How to styling agm-marker-label - max-width for set text to center ? I can change label position but can't set min-width for centralization label name.

<agm-marker *ngIf="school.lat && school.lng" 
                    [iconUrl]="{url: school.mapMarker, scaledSize: {height: 75,width: 48},labelOrigin:{x:70,y:20}}"
                    [label]="{text:school.schoolName}"
                    [longitude]="school.lng | parseFloat"
                    [latitude]="school.lat | parseFloat">
        </agm-marker>
like image 346
Максим Попов Avatar asked Mar 13 '18 09:03

Максим Попов


People also ask

How are markers displayed on the map?

The title of the marker. All markers are displayed on the map in order of their zIndex, with higher values displaying in front of markers with lower values. By default, markers are displayed according to their vertical position on screen, with lower markers appearing in front of markers further up the screen.

How do I use agmmarker infowindow?

AgmInfoWindow renders a info window inside a AgmMarker or standalone. Disable auto-pan on open. By default, the info window will pan the map so that it is fully visible when it opens. Sets the open state for the InfoWindow. You can also call the open () and close () methods.

Which animation to play when marker is added to map?

Which animation to play when marker is added to a map. This can be 'BOUNCE' or 'DROP' Icon (the URL of the image) for the foreground. The label (a single uppercase character) for the marker. The latitude position of the marker. The longitude position of the marker. If true, the marker can be clicked. Default value is true.


1 Answers

using 2 [label] attributes didn't work for me. Instead the following worked:

<agm-marker
        *ngFor="let sp of mySPlist"
        [latitude]="sp.geoLat" [longitude]="sp.geoLon"
        [iconUrl]="sp.icon"
        [label]="{color: 'white', text: sp.name}"
      >
</agm-marker>
like image 97
Shadi S Avatar answered Sep 21 '22 20:09

Shadi S