An API to customize the URL behavior and retrieve URL configuration

This API can customize the behavior of the URL. This includes optional trailing slashes (strictMode), case sensitivity (caseInsensitive), and custom parameter encoding (custom type).

It also has information about the location (url) configuration such as port and baseHref. This information can be used to build absolute URLs, such as `https://example.com:443/basepath/state/substate?param1=a#hashvalue`;

This API is found on UrlService.config.

### Hierarchy

- LocationConfig
- UrlMatcherConfig
  - UrlConfigApi

## Index

### Methods

- baseHref
- caseInsensitive
- defaultSquashPolicy
- dispose
- hashPrefix
- host
- html5Mode
- port
- protocol
- strictMode
- type

## Methods

- baseHref(): string

- Gets the base Href, e.g., `http://localhost/approot/`

- Gets the base Href, e.g., `http://localhost/approot/`

  #### Returns string

  :

  the application's base href

  Inherited from LocationConfig.baseHref

  - Defined in common/coreservices.ts:176

- caseInsensitive(value?: boolean): boolean

- Defines whether URL matching should be case sensitive (the default behavior), or not.

- Defines whether URL matching should be case sensitive (the default behavior), or not.

  #### Example:

      // Allow case insensitive url matches
      urlService.config.caseInsensitive(true);

  #### Parameters

  - ##### value: Optional boolean

    :

    `false` to match URL in a case sensitive manner; otherwise `true`;

  #### Returns boolean

  :

  the current value of caseInsensitive

  Inherited from UrlMatcherConfig.caseInsensitive

  - Defined in url/interface.ts:61

- defaultSquashPolicy(value?: string | true | false): string | true | false

- Sets the default behavior when generating or matching URLs with default parameter values.

- Sets the default behavior when generating or matching URLs with default parameter values.

  #### Example:

      // Remove default parameter values from the url
      urlService.config.defaultSquashPolicy(true);

  #### Parameters

  - ##### value: Optional string | true | false

    :

    A string that defines the default parameter URL squashing behavior.

    - `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL
    - `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the parameter is surrounded by slashes, squash (remove) one slash from the URL
    - any other string, e.g. "~": When generating an href with a default parameter value, squash (remove) the parameter value from the URL and replace it with this string.

  #### Returns string | true | false

  :

  the current value of defaultSquashPolicy

  Inherited from UrlMatcherConfig.defaultSquashPolicy

  - Defined in url/interface.ts:94

- dispose(router?: UIRouter): any

- Instructs the Disposable to clean up any resources

- Instructs the Disposable to clean up any resources

  #### Parameters

  - ##### router: Optional UIRouter

  #### Returns any

  Inherited from Disposable.dispose

  - Defined in interface.ts:123

- hashPrefix(): string

- Gets the hashPrefix (when not running in pushstate mode)

- hashPrefix(newprefix: string): string

- Sets the hashPrefix (when not running in pushstate mode)

- Gets the hashPrefix (when not running in pushstate mode)

  If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the "hashbang" portion.

  #### Returns string

  :

  the hash prefix

  Inherited from LocationConfig.hashPrefix

  - Defined in common/coreservices.ts:190

- Sets the hashPrefix (when not running in pushstate mode)

  #### Parameters

  - ##### newprefix string

  #### Returns string

  :

  the new hash prefix

  Inherited from LocationConfig.hashPrefix

  - Defined in common/coreservices.ts:196

- host(): string

- Gets the host, e.g., `localhost`

- Gets the host, e.g., `localhost`

  #### Returns string

  :

  the protocol

  Inherited from LocationConfig.host

  - Defined in common/coreservices.ts:170

- html5Mode(): boolean

- Returns true when running in pushstate mode

- Returns true when running in pushstate mode

  #### Returns boolean

  :

  true when running in pushstate mode

  Inherited from LocationConfig.html5Mode

  - Defined in common/coreservices.ts:182

- port(): number

- Gets the port, e.g., `80`

- Gets the port, e.g., `80`

  #### Returns number

  :

  the port number

  Inherited from LocationConfig.port

  - Defined in common/coreservices.ts:158

- protocol(): string

- Gets the protocol, e.g., `http`

- Gets the protocol, e.g., `http`

  #### Returns string

  :

  the protocol

  Inherited from LocationConfig.protocol

  - Defined in common/coreservices.ts:164

- strictMode(value?: boolean): boolean

- Defines whether URLs should match trailing slashes, or not (the default behavior).

- Defines whether URLs should match trailing slashes, or not (the default behavior).

  #### Example:

      // Allow optional trailing slashes
      urlService.config.strictMode(false);

  #### Parameters

  - ##### value: Optional boolean

    :

    `false` to match trailing slashes in URLs, otherwise `true`.

  #### Returns boolean

  :

  the current value of strictMode

  Inherited from UrlMatcherConfig.strictMode

  - Defined in url/interface.ts:75

- type(name: string, type?: ParamTypeDefinition): ParamType

- Creates and registers a custom ParamTypeDefinition object

- Creates and registers a custom ParamTypeDefinition object

  A custom parameter type can be used to generate URLs with typed parameters or custom encoding/decoding.

  #### Note: Register custom types before using them in a state definition.

  #### Example:

      // Encode object parameter as JSON string
      urlService.config.type('myjson', {
        encode: (obj) => JSON.stringify(obj),
        decode: (str) => JSON.parse(str),
        is: (val) => typeof(val) === 'object',
        pattern: /[^/]+/,
        equals: (a, b) => _.isEqual(a, b),
      });

  #### Parameters

  - ##### name string

    :

    The type name.

  - ##### type: Optional ParamTypeDefinition

    :

    The type definition. See ParamTypeDefinition for examples and information.

  #### Returns ParamType

  :

  if only the `name` parameter was specified: the currently registered ParamType object, or undefined

  Inherited from UrlMatcherConfig.type

  - Defined in url/interface.ts:120

Generated using TypeDoc