Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@angular/ssr): Add support for route matchers with fine-grained …
…render mode control This commit adds support for custom route matchers in Angular SSR, allowing fine-grained control over the `renderMode` (Server, Client) for individual routes, including those defined with matchers. Routes with custom matchers are **not** supported during prerendering and must explicitly define a `renderMode` of either server or client. The following configuration demonstrates how to use glob patterns (including recursive `**`) to define server-side rendering (SSR) or client-side rendering (CSR) for specific parts of the 'product' route and its child routes. ```typescript // app.routes.ts import { Routes } from '@angular/router'; export const routes: Routes = [ { path: '', component: DummyComponent, }, { path: 'product', component: DummyComponent, children: [ { path: '', component: DummyComponent, }, { path: 'list', component: DummyComponent, }, { matcher: () => null, // Example custom matcher (always returns null) component: DummyComponent, }, ], }, ]; ``` ```typescript // app.routes.server.ts import { RenderMode, ServerRoute } from '@angular/ssr'; export const serverRoutes: ServerRoute[] = [ { path: '**', renderMode: RenderMode.Client }, { path: 'product', renderMode: RenderMode.Prerender }, { path: 'product/list', renderMode: RenderMode.Prerender }, { path: 'product/**/overview/details', renderMode: RenderMode.Server }, ]; ``` Closes angular#29284
- Loading branch information