# Interface HookMatchCriteria

This object is used to configure whether or not a Transition Hook is invoked for a particular transition, based on the Transition's "to state" and "from state".

Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string, a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])

All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches. To match any transition, use an empty criteria object `{}`.

#### Example:

    // This matches a transition coming from the `parent` state and going to the `parent.child` state.
    var match = {
      to: 'parent',
      from: 'parent.child'
    }

#### Example:

    // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.
    var match = {
      to: 'parent',
      from: 'parent.**'
    }

#### Example:

    // This matches a transition coming from any state and going to any substate of `mymodule`
    var match = {
      to: 'mymodule.**'
    }

#### Example:

    // This matches a transition coming from any state and going to any state that has `data.authRequired`
    // set to a truthy value.
    var match = {
      to: function(state) {
        return state.data != null && state.data.authRequired === true;
      }
    }

#### Example:

    // This will match when route is just entered (initial load) or when the state is hard-refreshed
    // by specifying `{refresh: true}` as transition options.
    var match = {
      from: (state, transition) => state.self.name === '' || transition.options().reload
    }

#### Example:

    // This matches a transition that is exiting `parent.child`
    var match = {
      exiting: 'parent.child'
    }

interface HookMatchCriteria {
entering?: HookMatchCriterion;
exiting?: HookMatchCriterion;
from?: HookMatchCriterion;
retained?: HookMatchCriterion;
to?: HookMatchCriterion;
[key: string]: HookMatchCriterion;
}

#### Indexable

- [key: string]: HookMatchCriterion

- Defined in src/router/transition/interface.ts:851

##### Index

### Properties

entering?
exiting?
from?
retained?
to?

## Properties

### `Optional` entering

entering?: HookMatchCriterion

A [[HookMatchCriterion]] to match any state that would be entering

- Defined in src/router/transition/interface.ts:863

### `Optional` exiting

exiting?: HookMatchCriterion

A [[HookMatchCriterion]] to match any state that would be exiting

- Defined in src/router/transition/interface.ts:859

### `Optional` from

from?: HookMatchCriterion

A [[HookMatchCriterion]] to match the original (from) state

- Defined in src/router/transition/interface.ts:857

### `Optional` retained

retained?: HookMatchCriterion

A [[HookMatchCriterion]] to match any state that would be retained

- Defined in src/router/transition/interface.ts:861

### `Optional` to

to?: HookMatchCriterion

A [[HookMatchCriterion]] to match the destination state

- Defined in src/router/transition/interface.ts:855