StateRegistry | @uirouter/angularjs
Options
Menu

Hierarchy

  • StateRegistry

Index

Constructors

Properties

_router: UIRouter
builder: StateBuilder
listeners: StateRegistryListener[] = []
matcher: StateMatcher
stateQueue: StateQueueManager
states: object

Type declaration

Methods

  • _registerRoot(): void
  • decorator(name: string, func: BuilderFunction): Function | function | function[]
  • deregister(stateOrName: StateOrName): StateObject[]
  • 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 StateObject[]

    :

    a list of removed states


  • dispose(): void
  • Gets all registered states

    Calling this method with no arguments will return a list of all the states that are currently registered. Note: this does not return states that are queued but not yet registered.

    Returns StateDeclaration[]

    :

    a list of StateDeclarations


  • Gets a registered state

    Given a state or a name, finds and returns the StateDeclaration from the registry. Note: this does not return states that are queued but not yet registered.

    Parameters

    • stateOrName StateOrName
      :

      either the name of a state, or a state object.

    • base: Optional  StateOrName
      :

      the base state to use when stateOrName is relative.

    Returns StateDeclaration

    :

    a registered StateDeclaration that matched the stateOrName, or null if the state isn't registered.


  • 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;
      }
    });
    
       The function receives two parameters, `event` and `state`.
       See <a href="../modules/state.html#stateregistrylistener">StateRegistryListener</a>
    

    Parameters

    Returns function

    :

    a function that deregisters the listener

      • (): void
      • Returns void


  • Adds a state to the registry

    Registers a StateDeclaration or queues it for registration.

    Note: a state will be queued if the state's parent isn't yet registered.

         If the state was successfully registered, then the object is fully built (See: <a href="state.statebuilder.html">StateBuilder</a>).
         If the state was only queued, then the object is not fully built.
    

    Parameters

    Returns StateObject

    :

    the internal StateObject object.


Generated using TypeDoc