Skip to content

Query params not available in SSR #29967

Closed as not planned
Closed as not planned
@LeVraiSylvain

Description

@LeVraiSylvain

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

Don't known / other

Is this a regression?

Yes

Description

Steps to reproduce:

  1. Create an app called dummyapp using Angular CLI version 19.2.5 with the --ssr option (ng new dummyapp --ssr).

  2. In the app.component.ts, add the following code :

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, RouterOutlet } from '@angular/router';

@Component({
  selector: 'app-root',
  imports: [RouterOutlet],
  templateUrl: './app.component.html',
  styleUrl: './app.component.scss'
})
export class AppComponent implements OnInit {
  title = 'dummyapp';

/**
 *
 */
constructor(
  private route: ActivatedRoute
) {}

  ngOnInit(): void {
    this.route.queryParams.subscribe(async params => {
     this.title = params['title'];
    });
  }
}
  1. Run ng serve
  2. Start your browser and disable Javascript
  3. Navigate to http://localhost:4200/?title=MyTitle => It should work correcly
  4. Stop ng serve
  5. Run ng build && yarn serve:ssr:dummyapp
  6. Make sure Javascript is still disable in your browser
  7. Navigate to http://localhost:4000/?title=MyTitle => It does not work correcly. The title from the query string is not retrieved.

Image

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.2.5
Node: 22.14.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions