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 @ 2023-07-13 13:45  冰凝^  阅读(39)  评论(0编辑  收藏  举报