Bird
0
0

Which directive must be imported to use ngModel in a standalone Angular component?

easy🧠 Conceptual Q2 of 15
Angular - Template-Driven Forms
Which directive must be imported to use ngModel in a standalone Angular component?
ARouterModule
BHttpClientModule
CFormsModule
DCommonModule
Step-by-Step Solution
Solution:
  1. Step 1: Identify module for ngModel

    ngModel is part of Angular's forms package, provided by FormsModule.
  2. Step 2: Exclude unrelated modules

    HttpClientModule is for HTTP, RouterModule for routing, and CommonModule for common directives, none provide ngModel.
  3. Final Answer:

    FormsModule -> Option C
  4. Quick Check:

    ngModel needs FormsModule [OK]
Quick Trick: Import FormsModule to use ngModel [OK]
Common Mistakes:
MISTAKES
  • Importing CommonModule instead of FormsModule
  • Forgetting to import any module
  • Confusing routing or HTTP modules with forms

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes