function
developer preview
Bootstraps an instance of an Angular application and renders it to a string.
renderApplication<T>(rootComponent: Type<T>, options: { appId: string; document?: string | Document; url?: string; providers?: (Provider | ImportedNgModuleProviders)[]; platformProviders?: Provider[]; }): Promise<string>
rootComponent | Type<T> | A reference to a Standalone Component that should be rendered. |
options | object | Additional configuration for the render operation:
|
Promise<string>
: A Promise, that returns serialized (to a string) rendered page, once resolved.
Note: the root component passed into this function must be a standalone one (should have the standalone: true
flag in the @Component
decorator config).
@Component({ standalone: true, template: 'Hello world!' }) class RootComponent {} const output: string = await renderApplication(RootComponent, {appId: 'server-app'});
© 2010–2022 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/platform-server/renderApplication