拆分模块中遇到的问题

1. Can't bind to 'ngModel' since it isn't a known property of 'input'.

注:share中的模块不仅要imports 还要exports 给其他模块使用

解决办法:

1.app.module.ts中这个要引用 

2. 在share.module.ts中引入 FormsModule 。 因为这个只要用到ngmodel  就要引入,所以新建一个share.module.ts 共享模块。然后把这个共享模块导入其他分模块和根模块中即可

2.*ngFor in component: Can't bind to 'ngForOf' since it isn't a known property of 'div' [duplicate]

解决办法:

如上 在share中导入 commonModule

原文地址:https://www.cnblogs.com/maochunyan/p/9584818.html