diff --git a/adev/src/content/examples/ssr/src/app/app.config.server.ts b/adev/src/content/examples/ssr/src/app/app.config.server.ts index 9a4aca219d4..58b5b5ec753 100644 --- a/adev/src/content/examples/ssr/src/app/app.config.server.ts +++ b/adev/src/content/examples/ssr/src/app/app.config.server.ts @@ -1,11 +1,10 @@ import {mergeApplicationConfig, ApplicationConfig} from '@angular/core'; -import {provideServerRendering} from '@angular/platform-server'; -import {provideServerRouting} from '@angular/ssr'; +import {provideServerRendering, withRoutes} from '@angular/ssr'; import {appConfig} from './app.config'; import {serverRoutes} from './app.routes.server'; const serverConfig: ApplicationConfig = { - providers: [provideServerRendering(), provideServerRouting(serverRoutes)], + providers: [provideServerRendering(withRoutes(serverRoutes))], }; export const config = mergeApplicationConfig(appConfig, serverConfig); diff --git a/adev/src/content/guide/ssr.md b/adev/src/content/guide/ssr.md index 38f5eac28fd..8ea021c08a9 100644 --- a/adev/src/content/guide/ssr.md +++ b/adev/src/content/guide/ssr.md @@ -51,17 +51,16 @@ export const serverRoutes: ServerRoute[] = [ ]; ``` -You can add this config to your application using the [`provideServerRouting`](api/ssr/provideServerRouting 'API reference') function. +You can add this config to your application with [`provideServerRendering`](api/ssr/provideServerRendering 'API reference') using the [`withRoutes`](api/ssr/withRoutes 'API reference') function: ```typescript -import { provideServerRouting } from '@angular/ssr'; +import { provideServerRendering, withRoutes } from '@angular/ssr'; import { serverRoutes } from './app.routes.server'; // app.config.server.ts const serverConfig: ApplicationConfig = { providers: [ - provideServerRendering(), - provideServerRouting(serverRoutes), + provideServerRendering(withRoutes(serverRoutes)), // ... other providers ... ] }; @@ -70,12 +69,15 @@ const serverConfig: ApplicationConfig = { When using the [App shell pattern](ecosystem/service-workers/app-shell), you must specify the component to be used as the app shell for client-side rendered routes. To do this, use the [`withAppShell`](api/ssr/withAppShell 'API reference') fetaure: ```typescript -import { provideServerRouting, withAppShell } from '@angular/ssr'; +import { provideServerRendering, withRoutes, withAppShell } from '@angular/ssr'; import { AppShellComponent } from './app-shell/app-shell.component'; const serverConfig: ApplicationConfig = { providers: [ - provideServerRouting(serverRoutes, withAppShell(AppShellComponent)), + provideServerRendering( + withRoutes(serverRoutes), + withAppShell(AppShellComponent), + ), // ... other providers ... ] };