Angular - Reactive FormsWhich 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());Check Answer
Step-by-Step SolutionSolution:Step 1: Recall correct FormGroup creation syntaxFormGroup is created with new keyword and an object of FormControls.Step 2: Check each option for syntax correctnessthis.form = new FormGroup({name: new FormControl('')}); correctly uses new FormGroup with new FormControl inside an object.Final Answer:this.form = new FormGroup({name: new FormControl('')}); -> Option CQuick Check:Correct FormGroup syntax = new FormGroup with FormControl object [OK]Quick Trick: Use new FormGroup({controlName: new FormControl('')}) [OK]Common Mistakes:MISTAKESOmitting new keywordSwapping FormGroup and FormControlPassing wrong argument types
Master "Reactive Forms" in Angular9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Angular Quizzes HTTP Client - Interceptors for authentication tokens - Quiz 12easy Reactive Forms - ReactiveFormsModule setup - Quiz 8hard Reactive Forms - FormGroup for grouping controls - Quiz 8hard Reactive Forms - Custom validators - Quiz 2easy Routing - Defining routes array - Quiz 12easy Routing - Lazy loading modules with routes - Quiz 2easy Routing - Defining routes array - Quiz 2easy RxJS Operators - Why operators transform data streams - Quiz 1easy RxJS and Observables Fundamentals - Creating observables - Quiz 12easy Services and Dependency Injection - How dependency injection works in Angular - Quiz 4medium