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

Function LocationHashbangInHtml5Url

lib/test/angular/1.8.0/angular.js:14734–14766  ·  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

14732 * @param {string} hashPrefix hashbang prefix
14733 */
14734function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
14735 this.$$html5 = true;
14736 LocationHashbangUrl.apply(this, arguments);
14737
14738 this.$$parseLinkUrl = function(url, relHref) {
14739 if (relHref && relHref[0] === '#') {
14740 // special case for links to hash fragments:
14741 // keep the old url and only replace the hash fragment
14742 this.hash(relHref.slice(1));
14743 return true;
14744 }
14745
14746 var rewrittenUrl;
14747 var appUrl;
14748
14749 if (appBase === stripHash(url)) {
14750 rewrittenUrl = url;
14751 } else if ((appUrl = stripBaseUrl(appBaseNoFile, url))) {
14752 rewrittenUrl = appBase + hashPrefix + appUrl;
14753 } else if (appBaseNoFile === url + '/') {
14754 rewrittenUrl = appBaseNoFile;
14755 }
14756 if (rewrittenUrl) {
14757 this.$$parse(rewrittenUrl);
14758 }
14759 return !!rewrittenUrl;
14760 };
14761
14762 this.$$normalizeUrl = function(url) {
14763 // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'
14764 return appBase + hashPrefix + url;
14765 };
14766}
14767
14768
14769var locationPrototype = {

Callers

nothing calls this directly

Calls 2

stripHashFunction · 0.70
stripBaseUrlFunction · 0.70

Tested by

no test coverage detected