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.

Feature request: Router navigateById

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[v] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

Unable to restore previous history state by NavigationId

Expected behavior

Able to navigate to previous state simply by it’s id.

Will be great to have router method navigateById

What is the motivation / use case for changing the behavior?

You added id to router.events, to determine states history. You added restoredState to NavigationStart to determine restoration of previous router states. But, there is no option to navigate by this id.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
dawidgaruscommented, Sep 13, 2018

@glebmachine It’s still possible to do it yourself. I know because I’ve done that before, sadly I cannot share code. You would need to provide your own LocationStrategy, keep a stack with navigation ids which would be manipulated accordingly on pushState/replaceState/popState/NavigationEnd (really tricky to do it right) and use window.history.go - the stack will provide information how far You want to go.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 14, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Send data through routing paths in Angular - Stack Overflow
Best I found on internet for this is ngx-navigation-with-data. It is very simple and good for navigation the data from one component to...
Read more >
Common Routing Tasks - Angular
The last route with the path of ** is a wildcard route. The router selects this route if the requested URL doesn't match...
Read more >
Router navigate - option to trigger params subscription on ...
I have a parent and child routing configuration, where child is loaded based on the id required parameter of it's parent. ... I...
Read more >
Using Route Parameters - Rangle.io : Angular Training
The reason that the params property on ActivatedRoute is an Observable is that the router may not recreate the component when navigating to...
Read more >
9 Interesting Ways to Pass Data through Angular RouterState.
RouterState represents the state of the router as it keeps changing over time when users navigate from page to page. In this article,...
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