Interface ParamTypeDefinition

A developer can create a custom parameter type definition to customize the encoding and decoding of parameter values.
The definition should implement all the methods of this interface.

Parameter values are parsed from the URL as strings.
However, it is often useful to parse the string into some other form, such as:

integer

date

array of

custom object

some internal string representation

Typed parameter definitions control how parameter values are encoded (to the URL) and decoded (from the URL).
UI-Router always provides the decoded parameter values to the user (from methods such as Transition.params)).

For example, if a state has a url of /foo/{fooId:int} (the fooId parameter is of the int ParamType)
and if the browser is at /foo/123, then the 123 is parsed as an integer:

Hierarchy

Implemented by

Index

Properties

Methods

Properties

dynamic:boolean

Dynamic flag

Dynamic flag

When dynamic is true, changes to the parameter value will not cause the state to be entered/exited.

Normally, if a parameter value changes, the state which declared that the parameter will be reloaded (entered/exited).
When a parameter is dynamic, a transition still occurs, but it does not cause the state to exit/enter.

When a transition is run with TransitionOptions.inherit set to
true, the current param values are inherited in the new transition.
However, parameters whose type has inherit: false set will not be inherited.

The internal parameter type of hash has inherit: false.
This is used to disable inheriting of the hash value (#) on subsequent transitions.

Example:

$state.go('home', { '#': 'inboxAnchor' });
...
// "#" is not inherited.// The value of the "#" parameter will be `null`// The url's hash will be cleared.
$state.go('home.nest');

Detects whether some value is of this particular type.
Accepts a decoded value and determines whether it matches this ParamType object.

If your custom type encodes the parameter to a specific type, check for that type here.
For example, if your custom type decodes the URL parameter value as an array of ints, return true if the
input is an array of ints: