角导入app.module vs child.module中的FormsModule [英] Angular importing FormsModule in app.module vs child.module
本文介绍了角导入app.module vs child.module中的FormsModule的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将Angular与延迟加载模块一起使用.每个组件都有其自己的模块.如果我在根模块(app.module)中导入模块,则它必须可以正常工作.例如,我在app.module中导入了HttpClientModule
并可以在子组件中使用它.
I'm using Angular with lazy loading modules. Each component has its own module. If I import a module in the root module (app.module) it must work fine. For example, I imported HttpClientModule
in app.module and can use it in child components.
但是关于FormsModule
,这不能正常工作.我必须将其导入子模块中,否则会出现以下错误:
But about FormsModule
, this doesn't work fine. I must import it in the child module, otherwise, I get the following errors:
Can't bind to 'ngModel' since it isn't a known property of 'input'. ("
推荐答案
查看全文