草庐IT

ComponentFactoryResolver

全部标签

html - Angular:使用 ComponentFactoryResolver 动态实例化组件,在 SVG 内渲染

我有一个组件,它呈现DOM,它应该在svg标签内:import{Component,Input}from'@angular/core';@Component({selector:'g[hello]',template:`Hello,{{name}}`,styles:[`h1{font-family:Lato;}`]})exportclassHelloComponent{@Input()name:string;}当我静态实例化它时,一切正常(文本在页面上可见):生成以下DOM:Hello,Staticcomponent当我尝试使用ComponentFactoryResolver动态实例化

html - Angular:使用 ComponentFactoryResolver 动态实例化组件,在 SVG 内渲染

我有一个组件,它呈现DOM,它应该在svg标签内:import{Component,Input}from'@angular/core';@Component({selector:'g[hello]',template:`Hello,{{name}}`,styles:[`h1{font-family:Lato;}`]})exportclassHelloComponent{@Input()name:string;}当我静态实例化它时,一切正常(文本在页面上可见):生成以下DOM:Hello,Staticcomponent当我尝试使用ComponentFactoryResolver动态实例化