问题描述
我正在将mapQuest实施到我的有角项目中。该地图工作正常,并且还显示了弹出窗口,但是我在访问另一个组件HTML文件时遇到了问题。我设法解决了一些问题,但我认为这不是正确的解决方案。
在弹出窗口中,我想在有表格的地方显示另一个组件。我还需要提供输入。
示例:
父html:
<div id="map" style="height: -webkit-fill-available; width: -webkit-fill-available;">
</div>
<app-basicInfo [input]="testInput"></app-basicInfo>
此app-basicInfo不应位于HTML文件中。目前,如果我删除它,则其弹出窗口将无法正常工作。
父打字稿-问题:在bindPopup上,我想显示子组件。
L.marker([35.7392,-104.9903],{
icon: L.mapquest.icons.marker(),draggable: false
}).bindPopup(this.child.getHtmlContent()).addTo(this.map); <-- here
一般来说,我的问题是如何实现这样的目标:
bindPopup( "<app-basicInfo [input]="testInput"></app-basicInfo>" )
孩子:
<app-table style="width: 100%;" [dataSource]="dataSource" [displayedColumns]="displayedColumns">
<ng-content></ng-content>
</app-table>
儿童TS:
constructor(elRef: ElementRef) {
this.elRef = elRef;
}
getHtmlContent() {
return this.elRef.nativeElement.innerHTML;
}
我找不到答案,并且已经阅读了很多文档。我什至希望引用一些解决了此类问题的文件。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)