# Function registerLazyLoadHook

- registerLazyLoadHook(transitionService, stateService, urlService, stateRegistry): any

- A [[TransitionHookFn]] that performs lazy loading

  When entering a state "abc" which has a `lazyLoad` function defined:

  - Invoke the `lazyLoad` function (unless it is already in process)
    - Flag the hook function as "in process"
    - The function should return a promise (that resolves when lazy loading is complete)
  - Wait for the promise to settle
    - If the promise resolves to a [[LazyLoadResult]], then register those states
    - Flag the hook function as "not in process"
  - If the hook was successful
    - Remove the `lazyLoad` function from the state declaration
  - If all the hooks were successful
    - Retry the transition (by returning a TargetState)

      .state('abc', {
        component: 'fooComponent',
        lazyLoad: () => import('./fooComponent')
        });

  See [[StateDeclaration.lazyLoad]]

  #### Parameters

  - transitionService: any
  - stateService: any
  - urlService: any
  - stateRegistry: any

  #### Returns any

  - Defined in router/hooks/lazy-load.js:26