• 概要
@angular/platform-server

renderApplication

function
stable

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

API

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

renderApplication

Promise<string>

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

          
const bootstrap = () => bootstrapApplication(RootComponent, appConfig);const output: string = await renderApplication(bootstrap);
@parambootstrap() => Promise<ApplicationRef>

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

@paramoptions{ document?: string | Document | undefined; url?: string | undefined; platformProviders?: Provider[] | undefined; }

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.
@returnsPromise<string>

Description

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

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