【问题标题】:opening a popup at marker's click and loading another Angular component as popup's content单击标记时打开一个弹出窗口并将另一个 Angular 组件加载为弹出窗口的内容
【发布时间】:2022-07-11 02:35:41
【问题描述】:

我需要在标记处显示单击另一个角度组件的内容,将标记的 id 作为参数传递给...我没有找到可行的解决方案...直到我显示简单的 html 一切正常...

目前我的代码是

  var component = this.viewContainerRef.createComponent(MainPostCardComponent);

    marker.bindPopup(L.popup(
    component
    ));


    marker.bindPopup(component.location.nativeElement);
    marker.on('click', function (e) {
      if (this.currentSelectedMarker != null) {
        
        console.log("found previous item, resetting color");
        this.currentSelectedMarker.setIcon( new svgIcon);
      }//
     // marker.setIcon( new  svgSelectedIcon);
       this.currentSelectedMarker = marker;

     
      marker.openPopup();

      

    });


但这不起作用...有什么建议吗?

【问题讨论】:

    标签: angular leaflet


    【解决方案1】:

    在bindpopup函数内只能插入html

    【讨论】:

      猜你喜欢
      • 2012-12-12
      • 1970-01-01
      • 2020-06-03
      • 2021-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多