MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / $LocationProvider

Function $LocationProvider

lib/test/angular/1.7.0/angular.js:14532–14830  ·  view source on GitHub ↗

* @ngdoc provider * @name $locationProvider * @this * * @description * Use the `$locationProvider` to configure how the application deep linking paths are stored.

()

Source from the content-addressed store, hash-verified

14530 * Use the `$locationProvider` to configure how the application deep linking paths are stored.
14531 */
14532function $LocationProvider() {
14533 var hashPrefix = '!',
14534 html5Mode = {
14535 enabled: false,
14536 requireBase: true,
14537 rewriteLinks: true
14538 };
14539
14540 /**
14541 * @ngdoc method
14542 * @name $locationProvider#hashPrefix
14543 * @description
14544 * The default value for the prefix is `'!'`.
14545 * @param {string=} prefix Prefix for hash part (containing path and search)
14546 * @returns {*} current value if used as getter or itself (chaining) if used as setter
14547 */
14548 this.hashPrefix = function(prefix) {
14549 if (isDefined(prefix)) {
14550 hashPrefix = prefix;
14551 return this;
14552 } else {
14553 return hashPrefix;
14554 }
14555 };
14556
14557 /**
14558 * @ngdoc method
14559 * @name $locationProvider#html5Mode
14560 * @description
14561 * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.
14562 * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported
14563 * properties:
14564 * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to
14565 * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not
14566 * support `pushState`.
14567 * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies
14568 * whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are
14569 * true, and a base tag is not present, an error will be thrown when `$location` is injected.
14570 * See the {@link guide/$location $location guide for more information}
14571 * - **rewriteLinks** - `{boolean|string}` - (default: `true`) When html5Mode is enabled,
14572 * enables/disables URL rewriting for relative links. If set to a string, URL rewriting will
14573 * only happen on links with an attribute that matches the given string. For example, if set
14574 * to `'internal-link'`, then the URL will only be rewritten for `<a internal-link>` links.
14575 * Note that [attribute name normalization](guide/directive#normalization) does not apply
14576 * here, so `'internalLink'` will **not** match `'internal-link'`.
14577 *
14578 * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter
14579 */
14580 this.html5Mode = function(mode) {
14581 if (isBoolean(mode)) {
14582 html5Mode.enabled = mode;
14583 return this;
14584 } else if (isObject(mode)) {
14585
14586 if (isBoolean(mode.enabled)) {
14587 html5Mode.enabled = mode.enabled;
14588 }
14589

Callers

nothing calls this directly

Calls 14

isDefinedFunction · 0.70
isBooleanFunction · 0.70
isObjectFunction · 0.70
isStringFunction · 0.70
serverBaseFunction · 0.70
stripHashFunction · 0.70
stripFileFunction · 0.70
nodeName_Function · 0.70
isUndefinedFunction · 0.70
urlResolveFunction · 0.70
trimEmptyHashFunction · 0.70
startsWithFunction · 0.70

Tested by

no test coverage detected