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

External module ng1

Angular 1 plugin:

  • Provides an implementation for the CoreServices API, based on angular 1 services.
  • Also registers some services with the angular 1 injector.
  • Creates and bootstraps a new UIRouter object. Ties it to the the angular 1 lifecycle.

Index

Events

$stateChangeCancel: any

An event broadcast on $rootScope if a transition is cancelled.

An event broadcast on $rootScope if a transition is cancelled.

Additional arguments to the event handler are provided:

  • toState: the Transition Target state
  • toParams: the Transition Target Params
  • fromState: the state the transition is coming from
  • fromParams: the parameters from the state the transition is coming from
  • options: any Transition Options
  • $transition$: the Transition that was cancelled
deprecated
$stateChangeError: any

An event broadcast on $rootScope when an error occurs during transition.

An event broadcast on $rootScope when an error occurs during transition.

It's important to note that if you have any errors in your resolve functions (javascript errors, non-existent services, etc) they will not throw traditionally. You must listen for this $stateChangeError event to catch ALL errors.

Additional arguments to the event handler are provided:

  • toState: the Transition Target state
  • toParams: the Transition Target Params
  • fromState: the state the transition is coming from
  • fromParams: the parameters from the state the transition is coming from
  • error: The reason the transition errored.
  • options: any Transition Options
  • $transition$: the Transition that errored
deprecated

use TransitionService.onStart and Transition.promise, or Transition.onError

$stateChangeStart: any

An event broadcast on $rootScope when the state transition begins.

An event broadcast on $rootScope when the state transition begins.

You can use event.preventDefault() to prevent the transition from happening and then the transition promise will be rejected with a 'transition prevented' value.

Additional arguments to the event handler are provided:

  • toState: the Transition Target state
  • toParams: the Transition Target Params
  • fromState: the state the transition is coming from
  • fromParams: the parameters from the state the transition is coming from
  • options: any Transition Options
  • $transition$: the Transition
example

$rootScope.$on('$stateChangeStart', function(event, transition) {
  event.preventDefault();
  // transitionTo() promise will be rejected with
  // a 'transition prevented' error
})
deprecated

use TransitionService.onStart

$stateChangeSuccess: any

An event broadcast on $rootScope once the state transition is complete.

An event broadcast on $rootScope once the state transition is complete.

Additional arguments to the event handler are provided:

  • toState: the Transition Target state
  • toParams: the Transition Target Params
  • fromState: the state the transition is coming from
  • fromParams: the parameters from the state the transition is coming from
  • options: any Transition Options
  • $transition$: the Transition that just succeeded
deprecated

use TransitionService.onStart and Transition.promise, or Transition.onSuccess

$stateNotFound: any

An event broadcast on $rootScope when a requested state cannot be found using the provided state name.

An event broadcast on $rootScope when a requested state cannot be found using the provided state name.

The event is broadcast allowing any handlers a single chance to deal with the error (usually by lazy-loading the unfound state). A TargetState object is passed to the listener handler, you can see its properties in the example. You can use event.preventDefault() to abort the transition and the promise returned from transitionTo() will be rejected with a 'transition aborted' error.

Additional arguments to the event handler are provided:

  • unfoundState Unfound State information. Contains: to, toParams, options properties.
  • fromState: the state the transition is coming from
  • fromParams: the parameters from the state the transition is coming from
  • options: any Transition Options
example
// somewhere, assume lazy.state has not been defined
$state.go("lazy.state", { a: 1, b: 2 }, { inherit: false });

// somewhere else
$scope.$on('$stateNotFound', function(event, transition) {
function(event, unfoundState, fromState, fromParams){
    console.log(unfoundState.to); // "lazy.state"
    console.log(unfoundState.toParams); // {a:1, b:2}
    console.log(unfoundState.options); // {inherit:false} + default options
});
deprecated

use StateProvider.onInvalid // TODO: Move to [[StateService.onInvalid]]

Variables

router: UIRouter

Functions

  • $ViewScrollProvider(): void
  • ngdoc

    object

    name

    ui.router.state.$uiViewScrollProvider

    description

    Provider that returns the {@link ui.router.state.$uiViewScroll} service function.

    Returns void


  • $stateParamsFactory(ng1UIRouter: any, $rootScope: any): StateParams
  • annotateController(controllerExpression: any): string[]
  • Annotates a controller expression (may be a controller function(), a "controllername", or "controllername as name")

  • Annotates a controller expression (may be a controller function(), a "controllername", or "controllername as name")

    • Temporarily decorates $injector.instantiate.
    • Invokes $controller() service
      • Calls $injector.instantiate with controller constructor
    • Annotate constructor
    • Undecorate $injector

    returns an array of strings, which are the arguments of the controller expression

    Parameters

    • controllerExpression: any

    Returns string[]


  • bindToCtrlBindings(bindingsObj: any): Array<any>
  • getBindings(def: any): any
  • getComponentInputs($injector: any, name: any): any
  • ng1UIRouter($locationProvider: any): void
  • This angular 1 provider instantiates a Router and exposes its services via the angular injector

  • This angular 1 provider instantiates a Router and exposes its services via the angular injector

    Parameters

    • $locationProvider: any

    Returns void


  • resolveFactory(): object
  • Returns object

    • resolve: function
      • resolve(invocables: any, locals?: object, parent?: any): any
      • This emulates most of the behavior of the ui-router 0.2.x $resolve.resolve() service API.

      • This emulates most of the behavior of the ui-router 0.2.x $resolve.resolve() service API.

        Parameters

        • invocables: any
          :

          an object, with keys as resolve names and values as injectable functions

        • locals Default value: object = {}
          :

          key/value pre-resolved data (locals)

        • parent Optional: any
          :

          a promise for a "parent resolve"

        Returns any



  • runBlock($injector: any, $q: any): void
  • scopeBindings(bindingsObj: any): Array<string | RegExpExecArray>
  • watchDigests($rootScope: any): void

Generated using TypeDoc