UNPKG

4.92 kBTypeScriptView Raw
1import { IAngularEvent } from 'angular';
2/**
3 * An event broadcast on `$rootScope` when the state transition **begins**.
4 *
5 * ### Deprecation warning: use [[TransitionService.onStart]] instead
6 *
7 * You can use `event.preventDefault()`
8 * to prevent the transition from happening and then the transition promise will be
9 * rejected with a `'transition prevented'` value.
10 *
11 * Additional arguments to the event handler are provided:
12 * - `toState`: the Transition Target state
13 * - `toParams`: the Transition Target Params
14 * - `fromState`: the state the transition is coming from
15 * - `fromParams`: the parameters from the state the transition is coming from
16 * - `options`: any Transition Options
17 * - `$transition$`: the [[Transition]]
18 *
19 * #### Example:
20 * ```js
21 * $rootScope.$on('$stateChangeStart', function(event, transition) {
22 * event.preventDefault();
23 * // transitionTo() promise will be rejected with
24 * // a 'transition prevented' error
25 * })
26 * ```
27 *
28 * @event $stateChangeStart
29 * @deprecated
30 */
31export declare let $stateChangeStart: IAngularEvent;
32/**
33 * An event broadcast on `$rootScope` if a transition is **cancelled**.
34 *
35 * ### Deprecation warning: use [[TransitionService.onStart]] instead
36 *
37 * Additional arguments to the event handler are provided:
38 * - `toState`: the Transition Target state
39 * - `toParams`: the Transition Target Params
40 * - `fromState`: the state the transition is coming from
41 * - `fromParams`: the parameters from the state the transition is coming from
42 * - `options`: any Transition Options
43 * - `$transition$`: the [[Transition]] that was cancelled
44 *
45 * @event $stateChangeCancel
46 * @deprecated
47 */
48export declare let $stateChangeCancel: IAngularEvent;
49/**
50 * An event broadcast on `$rootScope` once the state transition is **complete**.
51 *
52 * ### Deprecation warning: use [[TransitionService.onStart]] and [[Transition.promise]], or [[Transition.onSuccess]]
53 *
54 * Additional arguments to the event handler are provided:
55 * - `toState`: the Transition Target state
56 * - `toParams`: the Transition Target Params
57 * - `fromState`: the state the transition is coming from
58 * - `fromParams`: the parameters from the state the transition is coming from
59 * - `options`: any Transition Options
60 * - `$transition$`: the [[Transition]] that just succeeded
61 *
62 * @event $stateChangeSuccess
63 * @deprecated
64 */
65export declare let $stateChangeSuccess: IAngularEvent;
66/**
67 * An event broadcast on `$rootScope` when an **error occurs** during transition.
68 *
69 * ### Deprecation warning: use [[TransitionService.onStart]] and [[Transition.promise]], or [[Transition.onError]]
70 *
71 * It's important to note that if you
72 * have any errors in your resolve functions (javascript errors, non-existent services, etc)
73 * they will not throw traditionally. You must listen for this $stateChangeError event to
74 * catch **ALL** errors.
75 *
76 * Additional arguments to the event handler are provided:
77 * - `toState`: the Transition Target state
78 * - `toParams`: the Transition Target Params
79 * - `fromState`: the state the transition is coming from
80 * - `fromParams`: the parameters from the state the transition is coming from
81 * - `error`: The reason the transition errored.
82 * - `options`: any Transition Options
83 * - `$transition$`: the [[Transition]] that errored
84 *
85 * @event $stateChangeError
86 * @deprecated
87 */
88export declare let $stateChangeError: IAngularEvent;
89/**
90 * An event broadcast on `$rootScope` when a requested state **cannot be found** using the provided state name.
91 *
92 * ### Deprecation warning: use [[StateService.onInvalid]] instead
93 *
94 * The event is broadcast allowing any handlers a single chance to deal with the error (usually by
95 * lazy-loading the unfound state). A `TargetState` object is passed to the listener handler,
96 * you can see its properties in the example. You can use `event.preventDefault()` to abort the
97 * transition and the promise returned from `transitionTo()` will be rejected with a
98 * `'transition aborted'` error.
99 *
100 * Additional arguments to the event handler are provided:
101 * - `unfoundState` Unfound State information. Contains: `to, toParams, options` properties.
102 * - `fromState`: the state the transition is coming from
103 * - `fromParams`: the parameters from the state the transition is coming from
104 * - `options`: any Transition Options
105 *
106 * #### Example:
107 * ```js
108 * // somewhere, assume lazy.state has not been defined
109 * $state.go("lazy.state", { a: 1, b: 2 }, { inherit: false });
110 *
111 * // somewhere else
112 * $scope.$on('$stateNotFound', function(event, transition) {
113 * function(event, unfoundState, fromState, fromParams){
114 * console.log(unfoundState.to); // "lazy.state"
115 * console.log(unfoundState.toParams); // {a:1, b:2}
116 * console.log(unfoundState.options); // {inherit:false} + default options
117 * });
118 * ```
119 *
120 * @event $stateNotFound
121 * @deprecated
122 */
123export declare let $stateNotFound: IAngularEvent;