AngularTS
    Preparing search index...

    Class StateRegistryProvider

    A registry for all of the application's [[StateDeclaration]]s

    This API is found at $stateRegistry.

    Index

    Constructors

    • Parameters

      • routerState: RouterProvider
      • compileProvider: CompileProvider

      Returns StateRegistryProvider

    Properties

    $get: ("$injector" | (($injector: InjectorService) => StateRegistryProvider))[] = ...

    Type Declaration

    $inject: ("$compileProvider" | "$$rProvider")[] = ...

    Methods

    • 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 BuiltStateDeclaration[]

      a list of removed states

    • Returns BuiltStateDeclaration[]

    • Listen for a State Registry events

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

      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

      • listener: StateRegistryListener

        a callback function invoked when the registered states changes. The function receives two parameters, event and state. See [[StateRegistryListener]]

      Returns () => void

      a function that deregisters the listener

    • 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.

      Parameters

      • stateDefinition: StateDeclarationInput

        the definition of the state to register.

      Returns StateObject

      the internal [[StateObject]] 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.

    • Gets the implicit root state

      Gets the root of the state tree. The root state is implicitly created by ng-router. Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]]

      Returns StateObject

      the root [[StateObject]]