* 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)
| 10850 | * @param {string} hashPrefix hashbang prefix |
| 10851 | */ |
| 10852 | function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) { |
| 10853 | this.$$html5 = true; |
| 10854 | LocationHashbangUrl.apply(this, arguments); |
| 10855 | |
| 10856 | this.$$parseLinkUrl = function(url, relHref) { |
| 10857 | if (relHref && relHref[0] === '#') { |
| 10858 | // special case for links to hash fragments: |
| 10859 | // keep the old url and only replace the hash fragment |
| 10860 | this.hash(relHref.slice(1)); |
| 10861 | return true; |
| 10862 | } |
| 10863 | |
| 10864 | var rewrittenUrl; |
| 10865 | var appUrl; |
| 10866 | |
| 10867 | if (appBase == stripHash(url)) { |
| 10868 | rewrittenUrl = url; |
| 10869 | } else if ((appUrl = beginsWith(appBaseNoFile, url))) { |
| 10870 | rewrittenUrl = appBase + hashPrefix + appUrl; |
| 10871 | } else if (appBaseNoFile === url + '/') { |
| 10872 | rewrittenUrl = appBaseNoFile; |
| 10873 | } |
| 10874 | if (rewrittenUrl) { |
| 10875 | this.$$parse(rewrittenUrl); |
| 10876 | } |
| 10877 | return !!rewrittenUrl; |
| 10878 | }; |
| 10879 | |
| 10880 | this.$$compose = function() { |
| 10881 | var search = toKeyValue(this.$$search), |
| 10882 | hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; |
| 10883 | |
| 10884 | this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; |
| 10885 | // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#' |
| 10886 | this.$$absUrl = appBase + hashPrefix + this.$$url; |
| 10887 | }; |
| 10888 | |
| 10889 | } |
| 10890 | |
| 10891 | |
| 10892 | var locationPrototype = { |
nothing calls this directly
no test coverage detected