我有一个应用程序,其中 app.component 只有路由器插座。ng-template
在从应用程序组件向下 4 级的组件中添加 ViewChild 之前,我没有任何问题。这是结构:
AppComponent 使用 FolderComponent 延迟加载 FolderModule。文件夹组件模板是呈现子组件的 ngFor。它是具有 ViewChild 的子组件。我不确定解释这一点的好方法。我认为错误中的 ngIf 是我的 ng-if,一旦有数据就会加载页面。我希望有人能认识到这个错误并告诉我它的含义以及为什么这么深的东西会导致应用程序的根本问题。ngIf 部分继续进行:
这是导致它的行。错误如下:
@ViewChild('performercontainer', {read: ViewContainerRef}) performerContainer: ViewContainerRef;
尝试在对象'function ViewContainerRef(){}'上使用描述符'{“value”:“RouterOutlet”,“configurable”:true}'配置'__source'并出错,放弃:TypeError:无法定义属性__source,object is not extensible zone.js:2257 Attempting to configure '__source' with descriptor '{"value":"NgIf","configurable":true}' on object 'function ViewContainerRef() { }' 并得到错误,放弃: TypeError:无法定义属性__source,对象不可扩展