question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Router loses parameters

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior By clicking on an RouterLink the URL will be updated but the params of ActivatedRoute.params stay empty.

Example: this.route.params.subscribe(params => { params are empty even if the url contains params });

Expected/desired behavior The ActivatedRoute Observer should submit all params from the url.

Please tell us about your environment:

  • Angular version: 2.0.0-rc.6
  • Router version: 3.0.0-rc.2
  • Browser: [Chrome52]
  • Language: [TypeScript]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
vugar005commented, Dec 27, 2017

Had this issue before. You can still access the params from other component which is not a direct child component by below method: this.route.pathFromRoot.forEach((route) => route.params.subscribe((params) => console.log(params));

1reaction
tscislocommented, Sep 20, 2016

@jneveux I guess this is the whole idea behind it, to provide route params only in active component. I do not get the concept yet and it bothers me as well, having anuglar-ui router experience. Maybe someone can elaborate?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 6 router loses route params - Stack Overflow
Given a main app, and lazy loaded module, I can access domain/base/name successfully, but all the recommended ways to access the route parameter...
Read more >
Router loses query params after push() with a dynamic route
I think I have found a router regression. When calling router.push with a dynamic route, any query string values are lost on the...
Read more >
Understand Routing in Vue.js With Examples | by SaidHayani
The $router method takes two parameters, first the name of the component, we want to navigate and the second parameter is the the...
Read more >
Parameterised Routes • Angular - codecraft.tv
With parameterised routes we can support variable paths in our routes. Angular also supports optional routes via passing in an object to the...
Read more >
Accessing Route Parameters with ActivatedRoute vs ...
If you have defined your route paths in app-routing.module.ts, ... For example, Your data will be lost after the page is refreshed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found