Bird
0
0

You are creating a feature module that uses reactive forms. Which of the following is the correct way to set up this feature module to use reactive forms properly?

hard🚀 Application Q8 of 15
Angular - Reactive Forms
You are creating a feature module that uses reactive forms. Which of the following is the correct way to set up this feature module to use reactive forms properly?
ADeclare <code>ReactiveFormsModule</code> in the feature module's declarations array.
BImport <code>ReactiveFormsModule</code> only in the root AppModule.
CImport <code>ReactiveFormsModule</code> in the feature module's imports array.
DAdd <code>ReactiveFormsModule</code> to the providers array of the feature module.
Step-by-Step Solution
Solution:
  1. Step 1: Feature module isolation

    Each Angular module needs to import ReactiveFormsModule if it uses reactive forms.
  2. Step 2: Correct import location

    ReactiveFormsModule must be imported in the feature module's imports array to make directives available to its components.
  3. Final Answer:

    Import ReactiveFormsModule in the feature module's imports array. -> Option C
  4. Quick Check:

    Modules do not share imports automatically; import where needed. [OK]
Quick Trick: Import ReactiveFormsModule in every module using reactive forms. [OK]
Common Mistakes:
MISTAKES
  • Importing ReactiveFormsModule only in AppModule and expecting it to propagate.
  • Adding ReactiveFormsModule to declarations or providers arrays.
  • Not importing ReactiveFormsModule in feature modules.

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes