Bird
0
0

Given this Angular module snippet, what will happen when the app runs?

medium📝 state output Q13 of 15
Angular - Reactive Forms
Given this Angular module snippet, what will happen when the app runs?
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ReactiveFormsModule } from '@angular/forms';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, ReactiveFormsModule],
  bootstrap: [AppComponent]
})
export class AppModule {}
AThe app will fail because ReactiveFormsModule is missing from imports
BThe app will only support template-driven forms
CThe app will throw a runtime error due to missing BrowserModule
DThe app can use reactive forms features like FormGroup and FormControl without errors
Step-by-Step Solution
Solution:
  1. Step 1: Check module imports

    The module imports BrowserModule and ReactiveFormsModule, which are required for running the app and using reactive forms respectively.
  2. Step 2: Confirm bootstrap and declarations

    AppComponent is declared and bootstrapped correctly, so the app starts properly.
  3. Final Answer:

    The app can use reactive forms features like FormGroup and FormControl without errors -> Option D
  4. Quick Check:

    ReactiveFormsModule imported = reactive forms work [OK]
Quick Trick: If ReactiveFormsModule is in imports, reactive forms work [OK]
Common Mistakes:
MISTAKES
  • Assuming ReactiveFormsModule is missing when it is imported
  • Confusing BrowserModule with ReactiveFormsModule
  • Thinking template-driven forms are enabled by ReactiveFormsModule

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes