Skip to content

ng-server-context="ssr" on prerendered (SSG) parameterized routes #29426

Closed
@vzarskus

Description

@vzarskus

Which @angular/* package(s) are the source of the bug?

platform-server

Is this a regression?

No

Description

Hello!

I have noticed that when prerendering with Angular19 parameterized routes feature (https://angular.dev/guide/hybrid-rendering#parameterized-routes), these prerendered index.htmls contain ng-server-context="ssr", which is odd, because I would expect them to have ng-server-context="ssg" - same as not parameterized routes.

I will give you some examples in pictures.

Here we see browser/translations/index.html have ng-server-context="ssg":
Image

Here we see two parameterized routes on browser/translations/irasu-valdymo-teorija/index.html and browser/translations/programines-irangos-inzinieriu-humoras/index.html having ng-server-context="ssr":

Image

Image

Is this intended?

Here is the relevant excerpt from app.routes.server.ts:

{
    path: 'translations/:slug',
    renderMode: RenderMode.Prerender,
    getPrerenderParams(): Promise<Record<string, string>[]> {
      return Promise.resolve(
        ['irasu-valdymo-teorija', 'programines-irangos-inzinieriu-humoras'].map(
          i => ({ slug: i }),
        ),
      );
    },
  },

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 19.1.1
Node: 20.18.0
Package Manager: npm 11.0.0
OS: win32 x64

Angular: 19.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser      
... platform-browser-dynamic, platform-server, router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1901.1
@angular-devkit/build-angular   19.1.1
@angular-devkit/core            19.1.1
@angular-devkit/schematics      19.1.1
@angular/cdk                    19.1.0
@schematics/angular             19.0.6
ng-packagr                      19.0.1
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else?

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions