【发布时间】:2017-05-14 15:27:04
【问题描述】:
我想知道是否有一种方法可以在不创建宿主元素的情况下测试 ng-content?
例如,如果我有警报组件 -
@Component({
selector: 'app-alert',
template: `
<div>
<ng-content></ng-content>
</div>
`,
})
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [AlertComponent]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AlertComponent);
component = fixture.componentInstance;
});
it('should display the ng content', () => {
});
如何在不创建宿主元素包装器的情况下设置ng-content?
【问题讨论】:
-
请参考,可能这个内容对你有帮助stackoverflow.com/questions/36464992/…
标签: javascript angular