Complete the code to bootstrap an Angular standalone component.
import { bootstrapApplication } from '@angular/platform-browser'; import { AppComponent } from './app.component'; bootstrapApplication([1]);
The bootstrapApplication function starts the Angular app with the root component, which is AppComponent here.
Complete the code to import the platform browser module for bootstrapping.
import { [1] } from '@angular/platform-browser';
platformBrowserDynamic which is for modulesbootstrapModulebootstrapApplication is the function used to start an Angular app with a standalone component.
Fix the error in the bootstrap code by completing the missing argument.
bootstrapApplication([1]).catch(err => console.error(err));The argument to bootstrapApplication must be the root component class, here AppComponent.
Fill both blanks to define a standalone component and bootstrap it.
import { Component } from '@angular/core'; import { bootstrapApplication } from '@angular/platform-browser'; @Component({ selector: 'app-root', template: '<h1>Hello Angular</h1>', [1]: true }) export class AppComponent {} bootstrapApplication([2]);
The standalone: true flag makes the component standalone. Then bootstrapApplication boots the AppComponent.
Fill all three blanks to bootstrap a standalone component with an import.
import { Component } from '@angular/core'; import { bootstrapApplication } from '@angular/platform-browser'; import { [1] } from '@angular/common'; @Component({ selector: 'app-root', template: '<p>Welcome!</p>', [2]: true, [3]: [CommonModule] }) export class AppComponent {} bootstrapApplication(AppComponent);
To use Angular features like ngIf, you import CommonModule. The component is standalone and declares imports.