Junior
From PDF
Angular
Angular
What is the role of NgModule in Angular?
- @NgModule is a decorator that defines a module.
- It declares which components, directives, and pipes belong to the module.
- It imports other modules needed for its components.
- It exports components/modules to make them available elsewhere.
- It configures services/providers scoped to the module.
Example:
@NgModule({
declarations: [MyComponent, MyDirective],
imports: [CommonModule],
exports: [MyComponent]
})
export class MyModule {}
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png