Bird
0
0

What is the main purpose of the NgModule decorator in Angular?

easy📝 Conceptual Q11 of 15
Angular - Modules
What is the main purpose of the NgModule decorator in Angular?
ATo group related components, directives, and services into a cohesive block
BTo define the HTML template of a component
CTo handle HTTP requests in Angular
DTo style components using CSS
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of NgModule

    The NgModule decorator organizes related parts of an Angular app like components and services.
  2. Step 2: Differentiate from other decorators

    Other decorators like Component define templates, but NgModule groups these parts together.
  3. Final Answer:

    To group related components, directives, and services into a cohesive block -> Option A
  4. Quick Check:

    NgModule groups app parts = A [OK]
Quick Trick: NgModule groups app parts, not templates or styles [OK]
Common Mistakes:
  • Confusing NgModule with Component decorator
  • Thinking NgModule handles styling or HTTP
  • Mixing NgModule with service injection only

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes