Bird
0
0

Identify the error in this Angular bootstrapping code:

medium📝 Debug Q14 of 15
Angular - Standalone Components
Identify the error in this Angular bootstrapping code:
import { bootstrapApplication } from '@angular/platform-browser';
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `

Welcome!

` }) export class AppComponent {} bootstrapApplication(AppComponent);
AMissing 'standalone: true' in the component decorator
BIncorrect import path for bootstrapApplication
CMissing bootstrapModule call instead of bootstrapApplication
DComponent selector should be 'app-root' in bootstrapApplication
Step-by-Step Solution
Solution:
  1. Step 1: Check component decorator for standalone flag

    The component lacks standalone: true, which is required for standalone bootstrapping.
  2. Step 2: Understand bootstrapApplication requirements

    Only standalone components can be bootstrapped with bootstrapApplication.
  3. Final Answer:

    Missing 'standalone: true' in the component decorator -> Option A
  4. Quick Check:

    Standalone flag required for bootstrapApplication [OK]
Quick Trick: Add standalone: true to component for bootstrapApplication [OK]
Common Mistakes:
  • Forgetting standalone: true in component
  • Using bootstrapModule with standalone component
  • Confusing selector name with bootstrapping method

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes