• Overview
@angular/platform-server

renderApplication

function
stable

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

API

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

Usage Notes

import { BootstrapContext, bootstrapApplication } from '@angular/platform-browser';
import { renderApplication } from '@angular/platform-server';
import { ApplicationConfig } from '@angular/core';
import { AppComponent } from './app.component';

const appConfig: ApplicationConfig = { providers: [...] };
const bootstrap = (context: BootstrapContext) =>
  bootstrapApplication(AppComponent, config, context);
const output = await renderApplication(bootstrap);
Jump to details