Bird
0
0

What is the role of the declarations array in the AppModule?

easy📝 Conceptual Q1 of 15
Angular - Modules
What is the role of the declarations array in the AppModule?
AIt sets the root component to bootstrap.
BIt specifies external libraries to import.
CIt defines services available application-wide.
DIt lists components, directives, and pipes that belong to this module.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of declarations in Angular modules

    The declarations array is used to register components, directives, and pipes that belong to the module.
  2. Step 2: Differentiate declarations from imports and providers

    Imports bring in other modules, providers register services, and bootstrap sets the root component. Declarations are specifically for components, directives, and pipes.
  3. Final Answer:

    It lists components, directives, and pipes that belong to this module. -> Option D
  4. Quick Check:

    declarations = components/directives/pipes [OK]
Quick Trick: Declarations hold components, directives, and pipes only [OK]
Common Mistakes:
  • Confusing declarations with imports or providers
  • Thinking declarations include services
  • Mixing bootstrap with declarations

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes