StateRegistry | @uirouter/angular
Options
All
  • Public
  • Public/Protected
  • All
Menu

A registry for all of the application's StateDeclarations

This API is found at router.stateRegistry (UIRouter.stateRegistry)

Hierarchy

  • StateRegistry

Index

Methods

decorator

  • Registers a BuilderFunction for a specific StateObject property (e.g., parent, url, or path). More than one BuilderFunction can be registered for a given property.

    The BuilderFunction(s) will be used to define the property on any subsequently built StateObject objects.

    Parameters

    • property: string

      The name of the State property being registered for.

    • builderFunction: BuilderFunction

      The BuilderFunction which will be used to build the State property

    Returns Function

    a function which deregisters the BuilderFunction

deregister

get

onStatesChanged

  • 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 () => void

    a function that deregisters the listener

      • (): void
      • Returns void

register

root

Generated using TypeDoc