我有一个模板组件,有条件地显示如下:
@Component({
selector: "presentation",
template: "<template #tpl><!-- HTML --></template>"
})
export class Presentation implements AfterViewInit {
@ViewChild('tpl') template: TemplateRef<any>;
constructor(private view: ViewContainerRef) {}
ngAfterViewInit() {
this.view.createEmbeddedView(this.template);
}
}
我正在尝试编写测试但是只要我打电话
it("should launch card in practice mode", () => {
fixture.detectChanges();
}
我明白了:
Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked
我做错了什么?