Title: $location.absUrl() returns undefined with base href and html5Mode · Issue #11091 · angular/angular.js · GitHub
Open Graph Title: $location.absUrl() returns undefined with base href and html5Mode · Issue #11091 · angular/angular.js
X Title: $location.absUrl() returns undefined with base href and html5Mode · Issue #11091 · angular/angular.js
Description: Running Angular 1.3.13 base href to load all assets from a specific subdirectory
Open Graph Description: Running Angular 1.3.13 base href to load all assets from a specific subdirectory
X Description: Running Angular 1.3.13 base href to load all assets from a specific subdirectory <base href="/marketing/" /> enable html 5 mode // remove hash /#/ $locationProvider.html5Mode(true);...
Mail addresses
notifications@github.com
Opengraph URL: https://github.com/angular/angular.js/issues/11091
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"$location.absUrl() returns undefined with base href and html5Mode","articleBody":"Running Angular 1.3.13\n\nbase href to load all assets from a specific subdirectory\n\n```\n \u003cbase href=\"/marketing/\" />\n```\n\nenable html 5 mode\n\n```\n // remove hash /#/\n $locationProvider.html5Mode(true);\n```\n\nRoutes are setup like this:\n\n```\n $routeProvider\n .when('/', {\n templateUrl: 'views/main.html',\n controller: 'MainCtrl'\n })\n .when('/about', {\n templateUrl: 'views/about.html',\n controller: 'AboutCtrl'\n })\n .otherwise({\n redirectTo: '/'\n });\n```\n\nUpon loading the application, the following error is thrown n times (I believe per anchor href on the page)\n\n```\n2VM9729 angular.js:11607 TypeError: Cannot read property 'replace' of undefined\n at trimEmptyHash (VM9729 angular.js:10564)\n at $LocationProvider.$get (VM9729 angular.js:11374)\n at Object.invoke (VM9729 angular.js:4185)\n at VM9729 angular.js:4003\n at getService (VM9729 angular.js:4144)\n at Object.invoke (VM9729 angular.js:4176)\n at VM9729 angular.js:4003\n at getService (VM9729 angular.js:4144)\n at Object.invoke (VM9729 angular.js:4176)\n at VM9729 angular.js:6485\n```\n\nDebugging this issue, I found at this line:\n\n```\n // rewrite hashbang url \u003c> html5 url\n if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {\n $browser.url($location.absUrl(), true);\n }\n```\n\n`$location.absUrl()` returns `undefined`\n\nMy GUESS is that the base href is throwing off the matching of routes at $.when('/'), and so is undefined...\n","author":{"url":"https://github.com/ilovett","@type":"Person","name":"ilovett"},"datePublished":"2015-02-17T22:40:08Z","url":"https://github.com/angular/angular.js/issues/11091"}
| 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:9a84960a-6c3a-65a0-60aa-622127bf3f72 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A264:D1FE3:3DF46B:5395E1:6AFE1F9A |
| html-safe-nonce | 5b0d6c7025e98b4650365c2ec10ffe46abf2c781cedc3880159f32f164f25c0e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjY0OkQxRkUzOjNERjQ2Qjo1Mzk1RTE6NkFGRTFGOUEiLCJ2aXNpdG9yX2lkIjoiOTE1MTUyMzUwNjQzOTk4NzA5OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5a1f9ee3bf14b8edf1bb091ac0ff88cfbd201fff8ef127977e2c820e593eec37 |
| hovercard-subject-tag | issue:57994006 |
| 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.js/11091/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a610ab74286e853e822d4e9b0b455b32d549d69a2237dd4879c5c4c9c796330b/angular/angular.js/issues/11091 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a610ab74286e853e822d4e9b0b455b32d549d69a2237dd4879c5c4c9c796330b/angular/angular.js/issues/11091 |
| og:image:alt | Running Angular 1.3.13 base href to load all assets from a specific subdirectory |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ilovett |
| hostname | github.com |
| expected-hostname | github.com |
| None | d0525ab1464526bf4532a5551aa348cf100dff75ef808a96fc67a08b1d946aa9 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular.js git https://github.com/angular/angular.js.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 460078 |
| octolytics-dimension-repository_nwo | angular/angular.js |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 460078 |
| octolytics-dimension-repository_network_root_nwo | angular/angular.js |
| 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 | fef3993a71fa20f7be8e167132fbf9619bc66e12 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width