简体   繁体   中英

Angular: Adding an import to app.module.ts throws an error

I thought that if you add an import to the controller.ts file, that it had to be added to app.module.ts as well. But, when I added the NgForm to my controller alone without adding it to app.module.ts my code worked fine. Then when I added it to app.module.ts I got an error. What is the right way to do it?

I got the answer at a different forum: If your controller.ts is part of a module that is added in app.module.ts then it doesn't need to have that import.

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