Bird
0
0

Which code snippet correctly bootstraps a standalone Angular component named 'MainComponent'?

easy📝 Syntax Q3 of 15
Angular - Standalone Components
Which code snippet correctly bootstraps a standalone Angular component named 'MainComponent'?
ANgModule.bootstrap(MainComponent);
BplatformBrowserDynamic().bootstrapModule(MainComponent);
CbootstrapApplication(MainComponent);
DbootstrapModule(MainComponent);
Step-by-Step Solution
Solution:
  1. Step 1: Identify bootstrap method for standalone components

    Standalone components use 'bootstrapApplication' instead of 'bootstrapModule'.
  2. Step 2: Match correct syntax

    The correct syntax is 'bootstrapApplication(MainComponent);'.
  3. Final Answer:

    bootstrapApplication(MainComponent); -> Option C
  4. Quick Check:

    Use bootstrapApplication() for standalone components [OK]
Quick Trick: Use bootstrapApplication() to start standalone components [OK]
Common Mistakes:
  • Using bootstrapModule() which is for NgModules
  • Calling platformBrowserDynamic().bootstrapModule() incorrectly
  • Confusing bootstrapApplication with NgModule bootstrap

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes