在 agm 中使用 svg 自定义标记

问题描述

我正在尝试在我的 agm-map 中自定义标记,但它不起作用。根据 apidocumentation,iconUrl 属性应该有效,但对我不起作用。


  <agm-map [latitude]="latitude" [longitude]="longitude">
            <agm-marker [latitude]="latitude" [longitude]="longitude" [label]="labelOptions"
                [iconUrl]=" '../../../assets/navbar/Box.svg'">
            </agm-marker>
        </agm-map>

我也用 url 创建了一个对象,但也不行

ts


import { Component,OnInit } from '@angular/core';

@Component({
  selector: 'app-shelter-map',templateUrl: './shelter-map.component.html',styleUrls: ['./shelter-map.component.scss']
})
export class ShelterMapComponent implements OnInit {
  latitude = 51.688418;
  longitude = 7.809007;
  labelOptions: any;
  public iconMap: any;

  constructor() {
    this.labelOptions = {
      color: '#ee4646',fontFamily: '',fontSize: '10px',fontWeight: 'bold',letterSpacing: '0.5px',}

    this.iconMap = {
      iconUrl: '../../../assets/navbar/Box.svg',iconHeight: '10'

    }

  }

  ngOnInit(): void {
  }

  

}


html

  <agm-map [latitude]="latitude" [longitude]="longitude">
            <agm-marker [latitude]="latitude" [longitude]="longitude" [label]="labelOptions"
                [iconUrl]="iconMap.iconUrl">
            </agm-marker>
        </agm-map>

感谢您的回复

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...