I made an Angular2 application as described here . It has two components (A, B) that are imported by the global app.module . My idea was to enable common modules in app.module , so I don't need to mess up every module with redundant code. I want to do this, for example, using FormsModule . So in app.module I have
imports: [ UniversalModule, CommonModule, FormsModule, AModule RouterModule.forRoot([]) ], exports: [FormsModule]
But in module A, I got the exception Can't bind to 'ngModel' since it isn't a known property of 'select'. , which seems to be caused by a missing FormsModule . It only works when I import FormsModule into each child module using imports: [FormsModule] . This is exactly what I want to avoid.
In accordance with this question, I tried to import AppModule into child module A. This does not work and gives me an exception Exception: Call to Node module failed with error: Error: Unexpected value 'undefined' imported by the module 'AModule'
How can I inherit the import of child modules? I need this for pipes too.
angular single-page-application
Lion
source share