You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
html5 mode with mismatching base href causes "TypeError: Cannot read property 'replace' of undefined" error in location.js #13565
If the tag does not match the actual href, $$parseLinkUrl will miss all the conditions and rewrittenUrl will not be defined, which means this.$$parse will not be called and $$absUrl will not be set.
), trimEmptyHash($location.absUrl()) will be called in a condition, which will end up having trimEmptyHash call .replace on undefined, so we end up halting with:
TypeError: Cannot read property 'replace' of undefined
In my case, the html was being served on multiple domains. Granted, we can correct that base url, but it still shouldn't cause a javascript error in angular.
I agree, this shouldn't cause an unknown error. This is happening to us, and we couldn't see it until production, and it simply killed the page. Having such a low-level JS error seems like something that should have feedback.
(It was a weird case in our situation, too, a production-only url rewrite that triggered an error.)
Activity
Narretz commentedon Dec 17, 2015
I'm not sure I understand the problem. In what case would the base tag not match the actual href?
jamlee1 commentedon Jan 4, 2016
In my case, the html was being served on multiple domains. Granted, we can correct that base url, but it still shouldn't cause a javascript error in angular.
OverZealous commentedon Feb 23, 2016
I agree, this shouldn't cause an unknown error. This is happening to us, and we couldn't see it until production, and it simply killed the page. Having such a low-level JS error seems like something that should have feedback.
(It was a weird case in our situation, too, a production-only url rewrite that triggered an error.)
gkalpak commentedon Jun 3, 2016
Should be fixed by #14488.
fix($location) : initialize `$$absUrl` to empty string
fix($location) : initialize `$$absUrl` to empty string