StateRegistry | UI-Router
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StateRegistry

Hierarchy

  • StateRegistry

Index

Constructors

Properties

_root: State
builder: StateBuilder
matcher: StateMatcher
stateQueue: StateQueueManager
states: object

Type declaration

urlRouterProvider: UrlRouterProvider

Methods

  • decorator(name: string, func: BuilderFunction): function | Array<function> | Function
  • deregister(stateOrName: StateOrName): Array<State>
  • Removes a state from the registry

  • Removes a state from the registry

    This removes a state from the registry. If the state has children, they are are also removed from the registry.

    Parameters

    • stateOrName: StateOrName
      :

      the state's name or object representation

    Returns Array<State>

    :

    a list of removed states


  • Listen for a State Registry events

    Adds a callback that is invoked when states are registered or deregistered with the StateRegistry.

    example
    
    let allStates = registry.get();
    
    // Later, invoke deregisterFn() to remove the listener
    let deregisterFn = registry.onStatesChanged((event, states) => {
      switch(event) {
        case: 'registered':
          states.forEach(state => allStates.push(state));
          break;
        case: 'deregistered':
          states.forEach(state => {
            let idx = allStates.indexOf(state);
            if (idx !== -1) allStates.splice(idx, 1);
          });
          break;
      }
    });
    

    Parameters

    Returns function

    :

    a function that deregisters the listener

      • (): void
      • Returns void


  • Adds a state to the registry

    Registers a [[StateDefinition]] or queues it for registration.

    Note: a state will be queued if the state's parent isn't yet registered. It will also be queued if the queue is not yet in StateQueueManager.autoFlush mode.

    Parameters

    Returns State

    :

    the internal State object. If the state was successfully registered, then the object is fully built (See: StateBuilder). If the state was only queued, then the object is not fully built.


  • root(): State
  • Gets the implicit root state

Generated using TypeDoc