Bird
0
0

Which of the following is the correct syntax to create a FormGroup in Angular reactive forms?

easy📝 Syntax Q3 of 15
Angular - Reactive Forms
Which of the following is the correct syntax to create a FormGroup in Angular reactive forms?
Athis.form = FormGroup({name: FormControl('')});
Bthis.form = new FormControl({name: new FormGroup('')});
Cthis.form = new FormGroup({name: new FormControl('')});
Dthis.form = new FormControl('name', new FormGroup());
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct FormGroup creation syntax

    FormGroup is created with new keyword and an object of FormControls.
  2. Step 2: Check each option for syntax correctness

    this.form = new FormGroup({name: new FormControl('')}); correctly uses new FormGroup with new FormControl inside an object.
  3. Final Answer:

    this.form = new FormGroup({name: new FormControl('')}); -> Option C
  4. Quick Check:

    Correct FormGroup syntax = new FormGroup with FormControl object [OK]
Quick Trick: Use new FormGroup({controlName: new FormControl('')}) [OK]
Common Mistakes:
MISTAKES
  • Omitting new keyword
  • Swapping FormGroup and FormControl
  • Passing wrong argument types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes