Provide routing details in router events
See original GitHub issueI’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[X] 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
Current behavior
Router#events
do not contain information on whether skipLocationChange
or replaceUrl
have been provided.
Expected behavior
Events such as NavigationEnd should contain these flags.
What is the motivation / use case for changing the behavior?
This would be useful, e.g,. to track navigation events to build an internal history stack which can be used to implement a »back button« in the app. However, there may be components within a page that change the URL but are used with replaceUrl
to prevent adding to the location history. In the router events, however, it is not possible to see whether these flags have been provided.
I also don’t want to use Location#back
because I’d like to provide an actual routerLink instead of a click handler such that the link is actually a proper link.
Environment
Angular version: 5.x
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Event - @angular/router
Router events that allow you to track the lifecycle of the router. See more... type Event = RouterEvent | NavigationStart | NavigationEnd |...
Read more >Angular Router Events - TekTutorialsHub
The Angular Router raises events when it navigates from one route to another route. It raises several events such as NavigationStart , NavigationEnd ......
Read more >Angular Routing Events and debugging - Medium
When we navigate through router by routerLink, navigateByUrl() or navigate() , each time Angular Router emit events for each phase of navigation ...
Read more >What are Router Events in Angular? - HackerNoon
An event triggered when routes are recognized. class RoutesRecognized extends RouterEvent { constructor(id: number, url: string, ...
Read more >Angular 2 router event listener - Stack Overflow
The angular 2 router events has different classes, and what gets passed to the subscription from the router.events ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for this issue. I can definitely see how this would be useful. Is this something you would like to create a PR for?
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.