A registry for parameter types.

This registry manages the built-in (and custom) parameter types.

The built-in parameter types are:

- string
- path
- query
- hash
- int
- bool
- date
- json
- any

### Hierarchy

- ParamTypes

## Index

### Constructors

- constructor

### Properties

- defaultTypes
- any
- bool
- date
- hash
- int
- json
- path
- query
- string

### Methods

- _flushTypeQueue
- dispose
- type

## Constructors

- new ParamTypes(): ParamTypes

- #### Returns ParamTypes

  - Defined in params/paramTypes.ts:201

## Properties

defaultTypes: any = pick(ParamTypes.prototype, ['hash', 'string', 'query', 'path', 'int', 'bool', 'date', 'json', 'any'])

- Defined in params/paramTypes.ts:201

any: ParamTypeDefinition

Built-in parameter type: `any`

Built-in parameter type: `any`

This parameter type is used by default for url-less parameters (parameters that do not appear in the URL). This type does not encode or decode. It is compared using a deep `equals` comparison.

#### Example:

This example defines a non-url parameter on a StateDeclaration.

    .state({
      name: 'new',
      url: '/new',
      params: {
        inrepyto: null
      }
    });

    $state.go('new', { inreplyto: currentMessage });

- Defined in params/paramTypes.ts:190

bool: ParamTypeDefinition

Built-in parameter type: `bool`

Built-in parameter type: `bool`

This parameter type serializes `true`/`false` as `1`/`0`

#### Example:

    .state({
      name: 'inbox',
      url: '/inbox?{unread:bool}'
    });

    $state.go('inbox', { unread: true });

The URL will serialize to: `/inbox?unread=1`.

Conversely, if the url is `/inbox?unread=0`, the value of the `unread` parameter will be a `false`.

- Defined in params/paramTypes.ts:119

date: ParamTypeDefinition

Built-in parameter type: `date`

Built-in parameter type: `date`

This parameter type can be used to serialize Javascript dates as parameter values.

#### Example:

    .state({
      name: 'search',
      url: '/search?{start:date}'
    });

    $state.go('search', { start: new Date(2000, 0, 1) });

The URL will serialize to: `/search?start=2000-01-01`.

Conversely, if the url is `/search?start=2016-12-25`, the value of the `start` parameter will be a `Date` object where:

- `date.getFullYear() === 2016`
- `date.getMonth() === 11` (month is 0-based)
- `date.getDate() === 25`

- Defined in params/paramTypes.ts:145

hash: ParamTypeDefinition

Built-in parameter type: `hash`

Built-in parameter type: `hash`

This parameter type is used for the `#` parameter (the hash) It behaves the same as the string parameter type.

- Defined in params/paramTypes.ts:75

int: ParamTypeDefinition

Built-in parameter type: `int`

Built-in parameter type: `int`

This parameter type serializes javascript integers (`number`s which represent an integer) to the URL.

#### Example:

    .state({
      name: 'user',
      url: '/user/{id:int}'
    });

    $state.go('user', { id: 1298547 });

The URL will serialize to: `/user/1298547`.

When the parameter value is read, it will be the `number` `1298547`, not the string `"1298547"`.

- Defined in params/paramTypes.ts:97

json: ParamTypeDefinition

Built-in parameter type: `json`

Built-in parameter type: `json`

This parameter type can be used to serialize javascript objects into the URL using JSON serialization.

#### Example:

This example serializes an plain javascript object to the URL

    .state({
      name: 'map',
      url: '/map/{coords:json}'
    });

    $state.go('map', { coords: { x: 10399.2, y: 49071 });

The URL will serialize to: `/map/%7B%22x%22%3A10399.2%2C%22y%22%3A49071%7D`

- Defined in params/paramTypes.ts:166

path: ParamTypeDefinition

Built-in parameter type: `path`

Built-in parameter type: `path`

This parameter type is the default type for path parameters. A path parameter is any parameter declared in the path portion of a url

- `/foo/:param1/:param2`: two path parameters

This parameter type behaves exactly like the string type with one exception. When matching parameter values in the URL, the `path` type does not match forward slashes `/`.

#### Angular 1 note:

In ng1, this type is overridden with one that pre-encodes slashes as `~2F` instead of `%2F`. For more details about this angular 1 behavior, see: https://github.com/angular-ui/ui-router/issues/2598

- Defined in params/paramTypes.ts:54

query: ParamTypeDefinition

Built-in parameter type: `query`

Built-in parameter type: `query`

This parameter type is the default type for query/search parameters. It behaves the same as the string parameter type.

A query parameter is any parameter declared in the query/search portion of a url

- `/bar?param2`: a query parameter

- Defined in params/paramTypes.ts:66

string: ParamTypeDefinition

Built-in parameter type: `string`

Built-in parameter type: `string`

This parameter type coerces values to strings. It matches anything (`new RegExp(".*")`) in the URL

- Defined in params/paramTypes.ts:37

## Methods

- _flushTypeQueue(): void

- #### Returns void

  - Defined in params/paramTypes.ts:236

- dispose(): void

- #### Returns void

  - Defined in params/paramTypes.ts:212

- type(name: string, definition?: ParamTypeDefinition, definitionFn?: function): any

- Registers a parameter type

- Registers a parameter type

  End users should call UrlMatcherFactory.type, which delegates to this method.

  #### Parameters

  - ##### name string

  - ##### definition: Optional ParamTypeDefinition

  - ##### definitionFn: Optional function

    - - (): ParamTypeDefinition

      - #### Returns ParamTypeDefinition

  #### Returns any

  - Defined in params/paramTypes.ts:221

Generated using TypeDoc