* @ngdoc object * @name ng.$locationProvider * @description * Use the `$locationProvider` to configure how the application deep linking paths are stored.
()
| 5498 | * Use the `$locationProvider` to configure how the application deep linking paths are stored. |
| 5499 | */ |
| 5500 | function $LocationProvider(){ |
| 5501 | var hashPrefix = '', |
| 5502 | html5Mode = false; |
| 5503 | |
| 5504 | /** |
| 5505 | * @ngdoc property |
| 5506 | * @name ng.$locationProvider#hashPrefix |
| 5507 | * @methodOf ng.$locationProvider |
| 5508 | * @description |
| 5509 | * @param {string=} prefix Prefix for hash part (containing path and search) |
| 5510 | * @returns {*} current value if used as getter or itself (chaining) if used as setter |
| 5511 | */ |
| 5512 | this.hashPrefix = function(prefix) { |
| 5513 | if (isDefined(prefix)) { |
| 5514 | hashPrefix = prefix; |
| 5515 | return this; |
| 5516 | } else { |
| 5517 | return hashPrefix; |
| 5518 | } |
| 5519 | }; |
| 5520 | |
| 5521 | /** |
| 5522 | * @ngdoc property |
| 5523 | * @name ng.$locationProvider#html5Mode |
| 5524 | * @methodOf ng.$locationProvider |
| 5525 | * @description |
| 5526 | * @param {string=} mode Use HTML5 strategy if available. |
| 5527 | * @returns {*} current value if used as getter or itself (chaining) if used as setter |
| 5528 | */ |
| 5529 | this.html5Mode = function(mode) { |
| 5530 | if (isDefined(mode)) { |
| 5531 | html5Mode = mode; |
| 5532 | return this; |
| 5533 | } else { |
| 5534 | return html5Mode; |
| 5535 | } |
| 5536 | }; |
| 5537 | |
| 5538 | this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', |
| 5539 | function( $rootScope, $browser, $sniffer, $rootElement) { |
| 5540 | var $location, |
| 5541 | basePath, |
| 5542 | pathPrefix, |
| 5543 | initUrl = $browser.url(), |
| 5544 | initUrlParts = matchUrl(initUrl), |
| 5545 | appBaseUrl; |
| 5546 | |
| 5547 | if (html5Mode) { |
| 5548 | basePath = $browser.baseHref() || '/'; |
| 5549 | pathPrefix = pathPrefixFromBase(basePath); |
| 5550 | appBaseUrl = |
| 5551 | composeProtocolHostPort(initUrlParts.protocol, initUrlParts.host, initUrlParts.port) + |
| 5552 | pathPrefix + '/'; |
| 5553 | |
| 5554 | if ($sniffer.history) { |
| 5555 | $location = new LocationUrl( |
| 5556 | convertToHtml5Url(initUrl, basePath, hashPrefix), |
| 5557 | pathPrefix, appBaseUrl); |
nothing calls this directly
no test coverage detected