MCPcopy
hub / github.com/angular-ui/ui-router / LocationHashbangInHtml5Url

Function LocationHashbangInHtml5Url

test/angular/1.7/angular.js:14669–14701  ·  view source on GitHub ↗

* LocationHashbangUrl represents URL * This object is exposed as $location service when html5 history api is enabled but the browser * does not support it. * * @constructor * @param {string} appBase application base URL * @param {string} appBaseNoFile application base URL stripped of any filen

(appBase, appBaseNoFile, hashPrefix)

Source from the content-addressed store, hash-verified

14667 * @param {string} hashPrefix hashbang prefix
14668 */
14669function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
14670 this.$$html5 = true;
14671 LocationHashbangUrl.apply(this, arguments);
14672
14673 this.$$parseLinkUrl = function(url, relHref) {
14674 if (relHref && relHref[0] === '#') {
14675 // special case for links to hash fragments:
14676 // keep the old url and only replace the hash fragment
14677 this.hash(relHref.slice(1));
14678 return true;
14679 }
14680
14681 var rewrittenUrl;
14682 var appUrl;
14683
14684 if (appBase === stripHash(url)) {
14685 rewrittenUrl = url;
14686 } else if ((appUrl = stripBaseUrl(appBaseNoFile, url))) {
14687 rewrittenUrl = appBase + hashPrefix + appUrl;
14688 } else if (appBaseNoFile === url + '/') {
14689 rewrittenUrl = appBaseNoFile;
14690 }
14691 if (rewrittenUrl) {
14692 this.$$parse(rewrittenUrl);
14693 }
14694 return !!rewrittenUrl;
14695 };
14696
14697 this.$$normalizeUrl = function(url) {
14698 // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'
14699 return appBase + hashPrefix + url;
14700 };
14701}
14702
14703
14704var locationPrototype = {

Callers

nothing calls this directly

Calls 2

stripHashFunction · 0.70
stripBaseUrlFunction · 0.70

Tested by

no test coverage detected