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 {}

More from Angular Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details