W3cubDocs

/Angular

renderApplication

function developer preview

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

© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/platform-server/renderApplication