Bird
0
0

Identify the error in this Angular bootstrap code:

medium📝 Debug Q14 of 15
Angular - Fundamentals
Identify the error in this Angular bootstrap code:
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppComponent);
AMissing parentheses after AppModule
BplatformBrowserDynamic() is deprecated, use bootstrapApplication()
CAppComponent should be AppModule in bootstrapModule()
DNo error, code is correct
Step-by-Step Solution
Solution:
  1. Step 1: Check bootstrapModule argument

    bootstrapModule() expects an Angular module, not a component.
  2. Step 2: Identify incorrect argument

    The code passes AppComponent instead of AppModule, causing an error.
  3. Final Answer:

    AppComponent should be AppModule in bootstrapModule() -> Option C
  4. Quick Check:

    bootstrapModule needs module, not component [OK]
Quick Trick: bootstrapModule() needs module, not component [OK]
Common Mistakes:
  • Passing component instead of module to bootstrapModule()
  • Thinking platformBrowserDynamic() is deprecated
  • Missing parentheses after module name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes