* 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} hashPrefix hashbang prefix
(appBase, hashPrefix)
| 9392 | * @param {string} hashPrefix hashbang prefix |
| 9393 | */ |
| 9394 | function LocationHashbangInHtml5Url(appBase, hashPrefix) { |
| 9395 | this.$$html5 = true; |
| 9396 | LocationHashbangUrl.apply(this, arguments); |
| 9397 | |
| 9398 | var appBaseNoFile = stripFile(appBase); |
| 9399 | |
| 9400 | this.$$rewrite = function(url) { |
| 9401 | var appUrl; |
| 9402 | |
| 9403 | if ( appBase == stripHash(url) ) { |
| 9404 | return url; |
| 9405 | } else if ( (appUrl = beginsWith(appBaseNoFile, url)) ) { |
| 9406 | return appBase + hashPrefix + appUrl; |
| 9407 | } else if ( appBaseNoFile === url + '/') { |
| 9408 | return appBaseNoFile; |
| 9409 | } |
| 9410 | }; |
| 9411 | |
| 9412 | this.$$compose = function() { |
| 9413 | var search = toKeyValue(this.$$search), |
| 9414 | hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; |
| 9415 | |
| 9416 | this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; |
| 9417 | // include hashPrefix in $$absUrl when $$url is empty so IE8 & 9 do not reload page because of removal of '#' |
| 9418 | this.$$absUrl = appBase + hashPrefix + this.$$url; |
| 9419 | }; |
| 9420 | |
| 9421 | } |
| 9422 | |
| 9423 | |
| 9424 | LocationHashbangInHtml5Url.prototype = |
nothing calls this directly
no test coverage detected