← Winnitude! Search  ·  Reader Mode (147 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
ANGULAR.DEV · Angular Team · 7 LINKS

renderModule · Angular

@angular/platform-server

renderModule

function stable View source

Bootstraps an application using provided NgModule and serializes the page content to string.

API

function renderModule<T>(

  moduleType: Type<T>,

  options: {

    document?: string | Document | undefined;

    url?: string | undefined;

    extraProviders?: StaticProvider[] | undefined;

    allowedHosts?: string[] | undefined;

  },

): Promise<string>;
@param moduleType Type<T>

A reference to an NgModule that should be used for bootstrap.

@param options { document?: string | Document | undefined; url?: string | undefined; extraProviders?: StaticProvider[] | undefined; allowedHosts?: string[] | 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.
  • extraProviders - set of platform level providers for the current render request.
  • allowedHosts - the allowed hosts list for host validation in server-side rendering. Entries may include an optional port (for example, example.com:443, *.example.com:8443, [::1]:4200, localhost:*, or *:8443). Omitting the port allows any port for that host.
@returns Promise<string>