* 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)
| 13898 | * @param {string} hashPrefix hashbang prefix |
| 13899 | */ |
| 13900 | function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) { |
| 13901 | this.$$html5 = true; |
| 13902 | LocationHashbangUrl.apply(this, arguments); |
| 13903 | |
| 13904 | this.$$parseLinkUrl = function(url, relHref) { |
| 13905 | if (relHref && relHref[0] === '#') { |
| 13906 | // special case for links to hash fragments: |
| 13907 | // keep the old url and only replace the hash fragment |
| 13908 | this.hash(relHref.slice(1)); |
| 13909 | return true; |
| 13910 | } |
| 13911 | |
| 13912 | var rewrittenUrl; |
| 13913 | var appUrl; |
| 13914 | |
| 13915 | if (appBase === stripHash(url)) { |
| 13916 | rewrittenUrl = url; |
| 13917 | } else if ((appUrl = stripBaseUrl(appBaseNoFile, url))) { |
| 13918 | rewrittenUrl = appBase + hashPrefix + appUrl; |
| 13919 | } else if (appBaseNoFile === url + '/') { |
| 13920 | rewrittenUrl = appBaseNoFile; |
| 13921 | } |
| 13922 | if (rewrittenUrl) { |
| 13923 | this.$$parse(rewrittenUrl); |
| 13924 | } |
| 13925 | return !!rewrittenUrl; |
| 13926 | }; |
| 13927 | |
| 13928 | this.$$compose = function() { |
| 13929 | var search = toKeyValue(this.$$search), |
| 13930 | hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; |
| 13931 | |
| 13932 | this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; |
| 13933 | // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#' |
| 13934 | this.$$absUrl = appBase + hashPrefix + this.$$url; |
| 13935 | |
| 13936 | this.$$urlUpdatedByLocation = true; |
| 13937 | }; |
| 13938 | |
| 13939 | } |
| 13940 | |
| 13941 | |
| 13942 | var locationPrototype = { |
nothing calls this directly
no test coverage detected