* 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)
| 9360 | * @param {string} hashPrefix hashbang prefix |
| 9361 | */ |
| 9362 | function LocationHashbangInHtml5Url(appBase, hashPrefix) { |
| 9363 | this.$$html5 = true; |
| 9364 | LocationHashbangUrl.apply(this, arguments); |
| 9365 | |
| 9366 | var appBaseNoFile = stripFile(appBase); |
| 9367 | |
| 9368 | this.$$rewrite = function(url) { |
| 9369 | var appUrl; |
| 9370 | |
| 9371 | if ( appBase == stripHash(url) ) { |
| 9372 | return url; |
| 9373 | } else if ( (appUrl = beginsWith(appBaseNoFile, url)) ) { |
| 9374 | return appBase + hashPrefix + appUrl; |
| 9375 | } else if ( appBaseNoFile === url + '/') { |
| 9376 | return appBaseNoFile; |
| 9377 | } |
| 9378 | }; |
| 9379 | |
| 9380 | this.$$compose = function() { |
| 9381 | var search = toKeyValue(this.$$search), |
| 9382 | hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; |
| 9383 | |
| 9384 | this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; |
| 9385 | // include hashPrefix in $$absUrl when $$url is empty so IE8 & 9 do not reload page because of removal of '#' |
| 9386 | this.$$absUrl = appBase + hashPrefix + this.$$url; |
| 9387 | }; |
| 9388 | |
| 9389 | } |
| 9390 | |
| 9391 | |
| 9392 | LocationHashbangInHtml5Url.prototype = |
nothing calls this directly
no test coverage detected