Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

renderApplication

Bootstraps an instance of an Angular application and renders it to a string.

See more...

      
      renderApplication<T>(bootstrap: () => Promise<ApplicationRef>, options: { document?: string | Document; url?: string; platformProviders?: Provider[]; }): Promise<string>
    
Parameters
bootstrap () => Promise<ApplicationRef>

A method that when invoked returns a promise that returns an ApplicationRef instance once resolved.

options object

Additional configuration for the render operation:

  • document - the document of the page to render, either as an HTML string or as a reference to the document instance.
  • url - the URL for the current render request.
  • platformProviders - the platform level providers for the current render request.
Returns

Promise<string>: A Promise, that returns serialized (to a string) rendered page, once resolved.

Description

      
      const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
const output: string = await renderApplication(bootstrap);