Problem Statement
What is an Angular module and what lives in declarations vs imports vs providers?
Explanation
An NgModule groups building blocks. `declarations` lists components, directives, pipes that belong to the module. `imports` brings in other modules’ exported declarations (e.g., CommonModule, RouterModule). `providers` registers services for DI in that injector. `bootstrap` lists root components (usually only in AppModule).
Code Solution
SolutionRead Only
@NgModule({
declarations: [HomeComponent],
imports: [BrowserModule, RouterModule.forRoot([])],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}