【发布时间】:2020-02-05 10:59:09
【问题描述】:
我想使用ViewChildren 将QueryList 由TemplateRef 转换成TemplateRef,但无法传递给输入组件。
例如
组件.ts:
@ViewChildren(TemplateRef) cellTemplates: QueryList<TemplateRef<any>>;
查看:
<my-component [templatesRef]="cellTemplates"></my-component>
输入:
_templatesRef;
@Input()
set templatesRef(refs: any) {
this._templatesRef = refs;
}
ExpressionChangedAfterItHasBeenCheckedError:表达式已更改 检查后。以前的值:'ngIf: false'。当前值: 'ngIf: true'。
【问题讨论】:
-
请提供您的完整代码,而不是您认为相关的代码。更好的是,提供minimal reproducible example 重现您的问题。
-
@Maryannah 是的,没错Stackbilitz,谢谢
标签: angular dom angular8 viewchild