问题描述
(角 CLI:1.7.4)
我在组件中使用 ViewChildren。如果我将其定义为
,则它工作正常@ViewChildren(TestComponent) testComponents;
但是,当我将 testComponents 的类型指定为 QueryList 时:
@ViewChildren(TestComponent) testComponents: QueryList<TestComponent>;
它给出了错误:
ERROR in ./src/app/components/search-component/search.component.ts Module not found: Error: Can't resolve '@angular/core/src/render3' in 'D:\Test Applications\test-application\src\app\components\search-component'
解决方法
删除 node-module 文件夹并从根目录运行“npm install”命令。这将安装 package.json 文件中列出的所有依赖项。如果要安装特定的包,请执行“npm i 你的包名”。 如果它不起作用,请告诉我?