#angular #google-maps #angular11 #agm #angular-maps
Вопрос:
Метка маркера Agm не будет принимать marginTop из моего массива MarkerOptions.
lt;agm-map [latitude]='latitude' [longitude]='longitude' [zoom]='zoomLevel' gt; lt;agm-marker *ngFor="let marker of allMarkers" [latitude]="marker.lat" [longitude]="marker.lng" [iconAnchorX]="10" [iconAnchorY]="10" [iconHeight]="20" [label]="marker.labelOption" [iconWidth]="20" [iconUrl]="marker.profileImageURL"gt; lt;/agm-markergt; lt;/agm-mapgt;
labelOption
( который находится внутри allMarkers
, для каждого маркера есть метка и стиль ) Я прохожу в это:
allMarkers = [ { lat: 21.1594627, lng: 72.6822083, label: 'Surat', profileImageURL:'assets/images/map-pin-price.png', labelOption:{ color: 'white', fontFamily: '', fontSize: '14px', fontWeight: 'bold', text: "240,000", marginTop: '10px' } }, { lat: 23.0204978, lng: 72.4396548, label: 'Ahmedabad', profileImageURL:'assets/images/map-pin-price.png', labelOption:{ color: 'white', fontFamily: '', fontSize: '14px', fontWeight: 'bold', text: "529,000", marginTop: '10px' } }, { lat: 22.2736308, lng: 70.7512555, label: 'Rajkot', profileImageURL:'assets/images/map-pin-price.png', labelOption:{ color: 'white', fontFamily: '', fontSize: '14px', fontWeight: 'bold', text: "480,323", lineHeight: '12px', marginTop: '10px' } } ];
Прямо сейчас результат, который я получаю, таков:
Я хотел бы перенести метку в центр значка ( придание ей поля 10 пикселей или добавление к ней класса решит проблему ) .