Title: Add location sync code for hash-based navigation from AngularJS · Issue #21995 · angular/angular · GitHub
Open Graph Title: Add location sync code for hash-based navigation from AngularJS · Issue #21995 · angular/angular
X Title: Add location sync code for hash-based navigation from AngularJS · Issue #21995 · angular/angular
Description: AnguarJS applications using hash-based URL navigation can encounter a problem after #21728 which added a value to history.state. In fact, AngularJS applications using hash-based URL navigation will encounter this problem any time somethi...
Open Graph Description: AnguarJS applications using hash-based URL navigation can encounter a problem after #21728 which added a value to history.state. In fact, AngularJS applications using hash-based URL navigation will...
X Description: AnguarJS applications using hash-based URL navigation can encounter a problem after #21728 which added a value to history.state. In fact, AngularJS applications using hash-based URL navigation will...
Opengraph URL: https://github.com/angular/angular/issues/21995
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add location sync code for hash-based navigation from AngularJS","articleBody":"AnguarJS applications using hash-based URL navigation can encounter a problem after #21728 which added a value to `history.state`. In fact, AngularJS applications using hash-based URL navigation will encounter this problem any time something exists in `history.state`.\r\n\r\nIt turns out the browser publishes a `popstate` event when the hash on the URL changes. So that's how the Angular router was getting notified of URL changes caused by the AngularJS router when using hash-based URL navigation. Apps didn't need the \"upgrade\" code because of this.\r\n\r\nThe change applied in #21728 gives the option to pass a \"state\" to the history API calls for Angular's Location service. This is something AngularJS had, but was never implemented in Angular.\r\n\r\nThe router used these new APIs to store it's `navigationId` in the history API which allows us to sync the two routers much better. However, there was a side effect in AngularJS which is if it sees the history API had been used, it assumes you want to update location through the history API rather than location.hash or location.url (both of which will trigger the `popstate` event Angular's router hooks into). If you use the history API directly, a `popstate` isn't published and therefore we needed to add the sync code to keep the two routers in sync (this is similar code anyone using HTML5 URLs would already have done). That code looks slightly different to manage hash-based URLs, and we will need to add this solution to the `@angular/router/upgrade` package for other projects to take advantage of.\r\n\r\n","author":{"url":"https://github.com/jasonaden","@type":"Person","name":"jasonaden"},"datePublished":"2018-02-02T17:24:24Z","url":"https://github.com/angular/angular/issues/21995"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2b32530d-c382-bf70-bec9-01531b586da3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CD3A:21AC3F:21E1F14:2ADA1B7:6B015B40 |
| html-safe-nonce | 21eb0dec76b52cf0647f1da39a2265b81e61aa8bfa4185df9956d53001b50f73 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDNBOjIxQUMzRjoyMUUxRjE0OjJBREExQjc6NkIwMTVCNDAiLCJ2aXNpdG9yX2lkIjoiMjU1OTU4NjMxMTYwMjI2NDg5NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 93b88aed033be9abe8c4c06d25c38846b8f23fad4dd2a24ff413b3dd8c15c565 |
| hovercard-subject-tag | issue:293963468 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/21995/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f6493f4ee2e791b58bbf717ddb21a1ffbf535143cfdf2aa14003a511a285b37c/angular/angular/issues/21995 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f6493f4ee2e791b58bbf717ddb21a1ffbf535143cfdf2aa14003a511a285b37c/angular/angular/issues/21995 |
| og:image:alt | AnguarJS applications using hash-based URL navigation can encounter a problem after #21728 which added a value to history.state. In fact, AngularJS applications using hash-based URL navigation will... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jasonaden |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width