我有(角度6)组件和TemplateRef<any>类型的输入参数
class TestComponent {
@Input() tpl: TemplateRef<any>;
...
}
Run Code Online (Sandbox Code Playgroud)
现在,我想创建一个测试,但找不到如何在测试中创建模板并将其设置为输入字段的方法。
在我的HTML中,我有类似的模板
<test>
<ng-template #tpl>
<div>OLOLO</div>
</ng-template>
</test>
Run Code Online (Sandbox Code Playgroud)
我需要这样的东西
fixture = TestBed.createComponent(TestComponent);
component = fixture.componentInstance;
component.template = here I need instance of TemplateRef
Run Code Online (Sandbox Code Playgroud)
谢谢