angular 三方插件创建html使用template

复制代码
html:
<ng-template #popTpl>
    <div>
        <p>title</p>
        <p>content</p>
    </div>
</ng-template>



ts:
@ViewChild("popTpl") popTpl;

constructor(private viewRef: ViewContainerRef) {}
createInfo() {
        const obj = this.pick?.id;
        const entity = new Cesium.Entity({
            name: obj?._name,
            description: this.viewRef.createEmbeddedView(this.popTpl).rootNodes[0].innerHTML
        });
        this.viewer.selectedEntity = entity;
    }
复制代码

 

posted @   冰凝^  阅读(39)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 上周热点回顾(2.17-2.23)
点击右上角即可分享
微信分享提示