Angular & Signals (283 Qs)•Part 9: NgModules, Providers, NgZone & Injector Hierarchies (213 - 255)
What are the imported modules in CLI generated feature modules?
In the CLI generated feature module, there are two JavaScript import statements at the top of the file
- NgModule: InOrder to use the
@NgModuledecorator - CommonModule: It provides many common directives such as
ngIfandngFor.
Practical Code Example
typescript
// Imported modules in CLI feature module:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; // Always imported in feature modules!
@NgModule({
imports: [CommonModule]
})
export class FeatureModule {}