Bootstraps an instance of an Angular application and renders a standalone component as the application's root component. More information about standalone components can be found in this guide.

bootstrapApplication(rootComponent: Type<unknown>, options?: ApplicationConfig): Promise<ApplicationRef>

rootComponent Type<unknown>

A reference to a standalone component that should be rendered.

options ApplicationConfig

Extra configuration for the bootstrap operation, see ApplicationConfig for additional info.

Optional. Default is undefined.


Promise<ApplicationRef>: A promise that returns an ApplicationRef instance once resolved.

Usage notes

The root component passed into this function must be a standalone one (should have the standalone: true flag in the @Component decorator config).

  standalone: true,
  template: 'Hello world!'
class RootComponent {}

const appRef: ApplicationRef = await bootstrapApplication(RootComponent);

You can add the list of providers that should be available in the application injector by specifying the providers field in an object passed as the second argument:

await bootstrapApplication(RootComponent, {
  providers: [
    {provide: BACKEND_URL, useValue: 'https://yourdomain.com/api'}

The importProvidersFrom helper method can be used to collect all providers from any existing NgModule (and transitively from all NgModules that it imports):

await bootstrapApplication(RootComponent, {
  providers: [

Note: the bootstrapApplication method doesn't include Testability by default. You can add Testability by getting the list of necessary providers using provideProtractorTestingSupport() function and adding them into the providers array, for example:

import {provideProtractorTestingSupport} from '@angular/platform-browser';

await bootstrapApplication(RootComponent, {providers: [provideProtractorTestingSupport()]});

© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.