# Class TransitionProvider

This class provides services related to Transitions.

- Most importantly, it allows global Transition Hooks to be registered.
- It allows the default transition error handler to be set.
- It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).

At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class.

This API is located at `router.transitionService` ([[UIRouter.transitionService]])

- Defined in src/router/transition/transition-service.js:63

##### Index

### Constructors

constructor

### Properties

_criteriaPaths
_deregisterHookFns
_eventTypes
_pluginapi
_registeredHooks
_transitionCount
$get
$view
globals
$inject

### Methods

_defineCoreEvents
_defineCorePaths
_defineEvent
_definePathType
_getEvents
_getPathTypes
_registerCoreTransitionHooks
create
getHooks

## Constructors

### constructor

- new TransitionProvider(
  globals: RouterGlobals,
  viewService: any,
  ): TransitionProvider

  #### Parameters

  - globals: RouterGlobals
  - viewService: any

  #### Returns TransitionProvider

  - Defined in src/router/transition/transition-service.js:69

## Properties

### _criteriaPaths

_criteriaPaths: {}

The paths on a criteria object

- Defined in src/router/transition/transition-service.js:76

### _deregisterHookFns

_deregisterHookFns: {}

- Defined in src/router/transition/transition-service.js:79

### _eventTypes

_eventTypes: any[]

The transition hook types, such as `onEnter`, `onStart`, etc

- Defined in src/router/transition/transition-service.js:72

### _pluginapi

_pluginapi: any

- Defined in src/router/transition/transition-service.js:80

### `Internal`_registeredHooks

_registeredHooks: {}

The registered transition hooks

- Defined in src/router/transition/transition-service.js:74

### _transitionCount

_transitionCount: number

- Defined in src/router/transition/transition-service.js:70

### $get

$get: (
| string
| (
(
stateService: any,
urlService: any,
stateRegistry: any,
viewService: any,
) => TransitionProvider
)
)[] = ...

- Defined in src/router/transition/transition-service.js:93

### $view

$view: any

- Defined in src/router/transition/transition-service.js:78

### globals

globals: RouterGlobals

- Defined in src/router/transition/transition-service.js:77

### `Static`$inject

$inject: string[] = ...

- Defined in src/router/transition/transition-service.js:64

## Methods

### _defineCoreEvents

- _defineCoreEvents(): void

  #### Returns void

  - Defined in src/router/transition/transition-service.js:166

### _defineCorePaths

- _defineCorePaths(): void

  #### Returns void

  - Defined in src/router/transition/transition-service.js:211

### _defineEvent

- _defineEvent(
  name: any,
  hookPhase: any,
  hookOrder: any,
  criteriaMatchPath: any,
  reverseSort?: boolean,
  getResultHandler?: (hook: any) => (result: any) => any,
  getErrorHandler?: () => (error: any) => any,
  synchronous?: boolean,
  ): void

  #### Parameters

  - name: any
  - hookPhase: any
  - hookOrder: any
  - criteriaMatchPath: any
  - reverseSort: boolean = false
  - getResultHandler: (hook: any) => (result: any) => any = TransitionHook.HANDLE_RESULT
    - - (hook: any): (result: any) => any

      - These GetResultHandler(s) are used by [[invokeHook]] below Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])

        #### Parameters

        - hook: any

        #### Returns (result: any) => any

  - getErrorHandler: () => (error: any) => any = TransitionHook.REJECT_ERROR
  - synchronous: boolean = false

  #### Returns void

  - Defined in src/router/transition/transition-service.js:220

### _definePathType

- _definePathType(name: any, hookScope: any): void
  `Internal`

  Adds a Path to be used as a criterion against a TreeChanges path

  For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path. It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)` Each state in the exiting path is checked against the criteria and returned as part of the match.

  Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path. It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)` Only the tail of the `to` path is checked against the criteria and returned as part of the match.

  #### Parameters

  - name: any
  - hookScope: any

  #### Returns void

  - Defined in src/router/transition/transition-service.js:266

### _getEvents

- _getEvents(phase: any): any[]

  #### Parameters

  - phase: any

  #### Returns any[]

  - Defined in src/router/transition/transition-service.js:244

### _getPathTypes

- _getPathTypes(): {}

  #### Returns {}

  - Defined in src/router/transition/transition-service.js:270

### _registerCoreTransitionHooks

- _registerCoreTransitionHooks(): void

  #### Returns void

  - Defined in src/router/transition/transition-service.js:278

### create

- create(fromPath: any, targetState: any): Transition
  `Internal`

  Creates a new [[Transition]] object

  This is a factory function for creating new Transition objects. It is used internally by the [[StateService]] and should generally not be called by application code.

  #### Parameters

  - fromPath: any

    the path to the current state (the from state)

  - targetState: any

    the target state (destination)

  #### Returns Transition

  a Transition

  - Defined in src/router/transition/transition-service.js:162

### getHooks

- getHooks(hookName: any): any

  #### Parameters

  - hookName: any

  #### Returns any

  - Defined in src/router/transition/transition-service.js:274