Bird
0
0

Why does Angular require the FormsModule to be imported for ngModel to work, instead of including it by default?

hard🧠 Conceptual Q10 of 15
Angular - Template-Driven Forms
Why does Angular require the FormsModule to be imported for ngModel to work, instead of including it by default?
ABecause ngModel only works in standalone components
BBecause ngModel is deprecated and optional
CTo prevent conflicts with reactive forms module
DTo keep the core bundle size small and load forms features only when needed
Step-by-Step Solution
Solution:
  1. Step 1: Understand Angular modular design

    Angular separates features into modules to optimize app size and performance.
  2. Step 2: Reason about FormsModule import

    FormsModule is imported only when forms features like ngModel are needed, avoiding unnecessary code in apps that don't use forms.
  3. Final Answer:

    To keep the core bundle size small and load forms features only when needed -> Option D
  4. Quick Check:

    Modular imports optimize bundle size [OK]
Quick Trick: Import modules only when features are used [OK]
Common Mistakes:
MISTAKES
  • Thinking ngModel is deprecated
  • Assuming ngModel works only in standalone components
  • Believing import prevents reactive forms usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes