There are no added tests here because the change is generally equivalent to what was there before. The goal of that piece of code is to prevent duplicate navigations due to the location synchronization code between AngularJS and Angular. That is, the Angular router listens to the `popstate` event and triggers navigations, but so does the AngularJS router and triggers navigations through `router.navigateByUrl`. The `setTimeout` in the Angular Router's `setUpLocationChangeListener` is there to make this bit of code work: the 'popstate'/'hashchange' navigation will necessarily come after the imperative nav triggered by AngularJS's location sync. Anyhow, in the long run, I would like to get rid of this bit of code altogether. We should not have special handling for these cases. The AngularJS/Angular location sync should either: 1. Not trigger a duplicate navigation in the first place or 2. Be tolerant to processing the duplicate navigation. In the short term, this change benefits the router while we investigate removing this logic completely because now browserUrlTree has a single responsiblity: to support `onSameUrlNavigation==='reload'`. This means that we can work towards removing the `browserUrlTree` tracking from the Router code at some point as well and have the `onSameUrlNavigation` logic be part of a pre-navigation hook that can be handled outside the `Router`. This may or may not be possible, but the change here opens up that change for investigation. PR Close #43632
Angular - The modern web developer's platform.
Angular is a development platform for building mobile and desktop web applications
using Typescript/JavaScript and other languages.
Contributing Guidelines
·
Submit an Issue
·
Blog
Documentation
Get started with Angular, learn the fundamentals and explore advanced topics on our documentation website.
Advanced
Development Setup
Prerequisites
- Install Node.js which includes Node Package Manager
Setting Up a Project
Install the Angular CLI globally:
npm install -g @angular/cli
Create workspace:
ng new [PROJECT NAME]
Run the application:
cd [PROJECT NAME]
ng serve
Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions.
Quickstart
Ecosystem
Changelog
Learn about the latest improvements.
Upgrading
Check out our upgrade guide to find out the best way to upgrade your project.
Contributing
Contributing Guidelines
Read through our contributing guidelines to learn about our submission process, coding rules and more.
Want to Help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues labeled as help wanted or good first issue.
Code of Conduct
Help us keep Angular open and inclusive. Please read and follow our Code of Conduct.
Community
Join the conversation and help the community.
Love Angular? Give our repo a star ⭐ ⬆️.
