Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
Say hello to Angular's future home!Check out Angular.devHome
/

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);