• Overview
@angular/ssr

provideServerRendering

function

Configures server-side rendering for an Angular application.

API

function provideServerRendering(  ...features: ServerRenderingFeature<ServerRenderingFeatureKind>[] ): EnvironmentProviders;

provideServerRendering

Configures server-side rendering for an Angular application.

This function sets up the necessary providers for server-side rendering, including support for server routes and app shell. It combines features configured using withRoutes and withAppShell to provide a comprehensive server-side rendering setup.

@paramfeaturesServerRenderingFeature<ServerRenderingFeatureKind>[]
  • Optional features to configure additional server rendering behaviors.

Description

Configures server-side rendering for an Angular application.

This function sets up the necessary providers for server-side rendering, including support for server routes and app shell. It combines features configured using withRoutes and withAppShell to provide a comprehensive server-side rendering setup.

Usage Notes

Basic example of how you can enable server-side rendering in your application when using the bootstrapApplication function:

import { bootstrapApplication } from '@angular/platform-browser';import { provideServerRendering, withRoutes, withAppShell } from '@angular/ssr';import { AppComponent } from './app/app.component';import { SERVER_ROUTES } from './app/app.server.routes';import { AppShellComponent } from './app/app-shell.component';bootstrapApplication(AppComponent, { providers: [ provideServerRendering( withRoutes(SERVER_ROUTES), withAppShell(AppShellComponent) ) ]});
Jump to details