简体   繁体   中英

Module not found: Error: Can't resolve '@angular/core/src/render3': ViewChildren QueryList

(Angular CLI: 1.7.4)

I am using ViewChildren in a component. It is working fine if I define it as

@ViewChildren(TestComponent) testComponents;

However, when I specify the type of testComponents as QueryList:

@ViewChildren(TestComponent) testComponents: QueryList<TestComponent>;

it gives error:

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'

Delete node-module folder and run 'npm install' command from the root directory.This installs all dependencies listed in package.json file.If you want to install specific package,execute'npm i your package name. Let me know if it dosen't work?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM