Bird
0
0

You want to bootstrap an Angular app using a standalone root component named RootComponent. Which is the best way to do this considering Angular 17+ standards?

hard📝 Application Q15 of 15
Angular - Fundamentals
You want to bootstrap an Angular app using a standalone root component named RootComponent. Which is the best way to do this considering Angular 17+ standards?
AUse <code>platformBrowserDynamic().bootstrapComponent(RootComponent);</code>
BCreate an AppModule and use <code>platformBrowserDynamic().bootstrapModule(AppModule);</code>
CCall <code>new Angular().bootstrap(RootComponent);</code>
DUse <code>bootstrapApplication(RootComponent);</code> to start the app
Step-by-Step Solution
Solution:
  1. Step 1: Understand Angular 17+ bootstrap options

    Angular 17+ encourages standalone components bootstrapped with bootstrapApplication().
  2. Step 2: Match best practice to options

    Use bootstrapApplication(RootComponent); to start the app uses bootstrapApplication() with RootComponent, the recommended way.
  3. Step 3: Eliminate incorrect options

    Create an AppModule and use platformBrowserDynamic().bootstrapModule(AppModule); uses module bootstrap, which is valid but not best for standalone. The other options use invalid syntax.
  4. Final Answer:

    Use bootstrapApplication(RootComponent); to start the app -> Option D
  5. Quick Check:

    Standalone bootstrap = bootstrapApplication() [OK]
Quick Trick: Use bootstrapApplication() for standalone root components [OK]
Common Mistakes:
  • Using module bootstrap for standalone components
  • Trying non-existent Angular() constructor
  • Using bootstrapComponent() which does not exist

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes