@angular-wave/angular.ts 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Makefile +1 -1
- package/README.md +3 -3
- package/TODO.md +14 -0
- package/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/index.html +2 -1
- package/package.json +1 -1
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +15 -6
- package/src/animations/animate-js.js +1 -1
- package/src/animations/animate-queue.js +1 -1
- package/src/animations/shared.js +0 -14
- package/src/core/compile.js +6 -3
- package/src/core/q.js +9 -9
- package/src/core/sanitize-uri.js +1 -1
- package/src/core/sce.js +1 -1
- package/src/directive/if.js +0 -79
- package/src/directive/if.md +80 -0
- package/src/directive/include.js +0 -82
- package/src/directive/include.md +86 -0
- package/src/directive/repeat.js +0 -1
- package/src/loader.js +0 -1
- package/src/public.js +0 -2
- package/src/router/common/trace.js +1 -1
- package/src/router/directives/stateDirectives.js +16 -14
- package/src/router/directives/viewDirective.js +2 -2
- package/src/router/hooks/resolve.js +3 -4
- package/src/router/hooks/views.js +3 -2
- package/src/router/state/stateService.js +1 -2
- package/src/router/transition/interface.js +14 -14
- package/src/router/transition/rejectFactory.js +29 -20
- package/src/router/transition/transitionHook.js +5 -5
- package/src/router/url/urlMatcher.js +1 -2
- package/src/router/url/urlRule.js +1 -1
- package/src/router/url/urlRules.js +1 -1
- package/src/shared/common.js +0 -1
- package/test/module-test.html +44 -12
- package/test/router/services.spec.js +71 -0
- package/test/router/state-directives.spec.js +1208 -0
- package/types/angular.d.ts +132 -124
- package/types/index.d.ts +2350 -2187
- package/types/jqlite.d.ts +463 -418
- package/types/router/core/common/common.d.ts +70 -24
- package/types/router/core/common/coreservices.d.ts +30 -32
- package/types/router/core/common/glob.d.ts +9 -9
- package/types/router/core/common/hof.d.ts +12 -4
- package/types/router/core/common/index.d.ts +8 -8
- package/types/router/core/common/predicates.d.ts +1 -1
- package/types/router/core/common/queue.d.ts +13 -13
- package/types/router/core/common/safeConsole.d.ts +3 -3
- package/types/router/core/common/strings.d.ts +4 -2
- package/types/router/core/common/trace.d.ts +94 -82
- package/types/router/core/globals.d.ts +37 -37
- package/types/router/core/hooks/coreResolvables.d.ts +5 -3
- package/types/router/core/hooks/ignoredTransition.d.ts +4 -2
- package/types/router/core/hooks/invalidTransition.d.ts +4 -2
- package/types/router/core/hooks/lazyLoad.d.ts +10 -5
- package/types/router/core/hooks/onEnterExitRetain.d.ts +10 -4
- package/types/router/core/hooks/redirectTo.d.ts +4 -2
- package/types/router/core/hooks/resolve.d.ts +10 -4
- package/types/router/core/hooks/updateGlobals.d.ts +4 -2
- package/types/router/core/hooks/url.d.ts +4 -2
- package/types/router/core/hooks/views.d.ts +7 -3
- package/types/router/core/index.d.ts +11 -12
- package/types/router/core/interface.d.ts +83 -81
- package/types/router/core/params/index.d.ts +5 -5
- package/types/router/core/params/interface.d.ts +439 -439
- package/types/router/core/params/param.d.ts +72 -60
- package/types/router/core/params/paramType.d.ts +40 -40
- package/types/router/core/params/paramTypes.d.ts +169 -165
- package/types/router/core/params/stateParams.d.ts +13 -13
- package/types/router/core/path/index.d.ts +2 -2
- package/types/router/core/path/pathNode.d.ts +49 -49
- package/types/router/core/path/pathUtils.d.ts +100 -74
- package/types/router/core/resolve/index.d.ts +3 -3
- package/types/router/core/resolve/interface.d.ts +137 -137
- package/types/router/core/resolve/resolvable.d.ts +60 -54
- package/types/router/core/resolve/resolveContext.d.ts +84 -79
- package/types/router/core/router.d.ts +95 -86
- package/types/router/core/state/index.d.ts +8 -8
- package/types/router/core/state/interface.d.ts +667 -643
- package/types/router/core/state/stateBuilder.d.ts +41 -38
- package/types/router/core/state/stateMatcher.d.ts +11 -9
- package/types/router/core/state/stateObject.d.ts +154 -139
- package/types/router/core/state/stateQueueManager.d.ts +26 -21
- package/types/router/core/state/stateRegistry.d.ts +124 -121
- package/types/router/core/state/stateService.d.ts +380 -343
- package/types/router/core/state/targetState.d.ts +74 -69
- package/types/router/core/transition/hookBuilder.d.ts +34 -30
- package/types/router/core/transition/hookRegistry.d.ts +96 -74
- package/types/router/core/transition/index.d.ts +8 -8
- package/types/router/core/transition/interface.d.ts +652 -609
- package/types/router/core/transition/rejectFactory.d.ts +97 -97
- package/types/router/core/transition/transition.d.ts +565 -517
- package/types/router/core/transition/transitionEventType.d.ts +20 -11
- package/types/router/core/transition/transitionHook.d.ts +90 -82
- package/types/router/core/transition/transitionService.d.ts +228 -161
- package/types/router/core/url/index.d.ts +8 -8
- package/types/router/core/url/interface.d.ts +100 -87
- package/types/router/core/url/urlConfig.d.ts +130 -126
- package/types/router/core/url/urlMatcher.d.ts +132 -127
- package/types/router/core/url/urlMatcherFactory.d.ts +46 -42
- package/types/router/core/url/urlRouter.d.ts +91 -75
- package/types/router/core/url/urlRule.d.ts +123 -100
- package/types/router/core/url/urlRules.d.ts +240 -232
- package/types/router/core/url/urlService.d.ts +201 -201
- package/types/router/core/view/index.d.ts +2 -2
- package/types/router/core/view/interface.d.ts +26 -26
- package/types/router/core/view/view.d.ts +152 -143
- package/types/router/directives/viewDirective.d.ts +12 -11
- package/types/router/index.d.ts +11 -12
- package/types/router/interface.d.ts +361 -351
- package/types/router/legacy/resolveService.d.ts +44 -40
- package/types/router/legacy/stateEvents.d.ts +1 -1
- package/types/router/locationServices.d.ts +45 -37
- package/types/router/services.d.ts +9 -9
- package/types/router/stateFilters.d.ts +3 -3
- package/types/router/stateProvider.d.ts +240 -235
- package/types/router/statebuilders/onEnterExitRetain.d.ts +4 -2
- package/types/router/statebuilders/views.d.ts +35 -22
- package/types/router/templateFactory.d.ts +99 -79
- package/types/router/viewScroll.d.ts +7 -7
- package/src/directive/a.js +0 -37
- package/test/directive/a.spec.js +0 -192
- package/types/router/angular.d.ts +0 -1
- package/types/router/core/vanilla.d.ts +0 -1
- package/types/router/directives/stateDirectives.d.ts +0 -3
- package/types/router/injectables.d.ts +0 -1
|
@@ -1,350 +1,387 @@
|
|
|
1
|
-
import { HookResult, TransitionOptions } from
|
|
2
|
-
import { Transition } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { HookResult, TransitionOptions } from "../transition/interface";
|
|
2
|
+
import { Transition } from "../transition/transition";
|
|
3
|
+
import {
|
|
4
|
+
HrefOptions,
|
|
5
|
+
LazyLoadResult,
|
|
6
|
+
StateDeclaration,
|
|
7
|
+
StateOrName,
|
|
8
|
+
TransitionPromise,
|
|
9
|
+
} from "./interface";
|
|
10
|
+
import { StateObject } from "./stateObject";
|
|
11
|
+
import { TargetState } from "./targetState";
|
|
12
|
+
import { RawParams } from "../params/interface";
|
|
13
|
+
import { UIRouter } from "../router";
|
|
14
|
+
import { UIInjector } from "../interface";
|
|
15
|
+
import { StateParams } from "../params/stateParams";
|
|
16
|
+
export declare type OnInvalidCallback = (
|
|
17
|
+
toState?: TargetState,
|
|
18
|
+
fromState?: TargetState,
|
|
19
|
+
injector?: UIInjector,
|
|
20
|
+
) => HookResult;
|
|
11
21
|
/**
|
|
12
22
|
* Provides services related to ui-router states.
|
|
13
23
|
*
|
|
14
24
|
* This API is located at `router.stateService` ([[UIRouter.stateService]])
|
|
15
25
|
*/
|
|
16
26
|
export declare class StateService {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
27
|
+
private router;
|
|
28
|
+
/** @internal */
|
|
29
|
+
invalidCallbacks: OnInvalidCallback[];
|
|
30
|
+
/**
|
|
31
|
+
* The [[Transition]] currently in progress (or null)
|
|
32
|
+
*
|
|
33
|
+
* @deprecated This is a passthrough through to [[UIRouterGlobals.transition]]
|
|
34
|
+
*/
|
|
35
|
+
transition: Transition;
|
|
36
|
+
/**
|
|
37
|
+
* The latest successful state parameters
|
|
38
|
+
*
|
|
39
|
+
* @deprecated This is a passthrough through to [[UIRouterGlobals.params]]
|
|
40
|
+
*/
|
|
41
|
+
params: StateParams;
|
|
42
|
+
/**
|
|
43
|
+
* The current [[StateDeclaration]]
|
|
44
|
+
*
|
|
45
|
+
* @deprecated This is a passthrough through to [[UIRouterGlobals.current]]
|
|
46
|
+
*/
|
|
47
|
+
current: StateDeclaration;
|
|
48
|
+
/**
|
|
49
|
+
* The current [[StateObject]] (an internal API)
|
|
50
|
+
*
|
|
51
|
+
* @deprecated This is a passthrough through to [[UIRouterGlobals.$current]]
|
|
52
|
+
*/
|
|
53
|
+
$current: StateObject;
|
|
54
|
+
/** @internal */
|
|
55
|
+
constructor(/** @internal */ router: UIRouter);
|
|
56
|
+
/** @internal */
|
|
57
|
+
dispose(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Handler for when [[transitionTo]] is called with an invalid state.
|
|
60
|
+
*
|
|
61
|
+
* Invokes the [[onInvalid]] callbacks, in natural order.
|
|
62
|
+
* Each callback's return value is checked in sequence until one of them returns an instance of TargetState.
|
|
63
|
+
* The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.
|
|
64
|
+
*
|
|
65
|
+
* If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.
|
|
66
|
+
*
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
private _handleInvalidTargetState;
|
|
70
|
+
/**
|
|
71
|
+
* Registers an Invalid State handler
|
|
72
|
+
*
|
|
73
|
+
* Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]
|
|
74
|
+
* has been called with an invalid state reference parameter
|
|
75
|
+
*
|
|
76
|
+
* Example:
|
|
77
|
+
* ```js
|
|
78
|
+
* stateService.onInvalid(function(to, from, injector) {
|
|
79
|
+
* if (to.name() === 'foo') {
|
|
80
|
+
* let lazyLoader = injector.get('LazyLoadService');
|
|
81
|
+
* return lazyLoader.load('foo')
|
|
82
|
+
* .then(() => stateService.target('foo'));
|
|
83
|
+
* }
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @param {function} callback invoked when the toState is invalid
|
|
88
|
+
* This function receives the (invalid) toState, the fromState, and an injector.
|
|
89
|
+
* The function may optionally return a [[TargetState]] or a Promise for a TargetState.
|
|
90
|
+
* If one is returned, it is treated as a redirect.
|
|
91
|
+
*
|
|
92
|
+
* @returns a function which deregisters the callback
|
|
93
|
+
*/
|
|
94
|
+
onInvalid(callback: OnInvalidCallback): Function;
|
|
95
|
+
/**
|
|
96
|
+
* Reloads the current state
|
|
97
|
+
*
|
|
98
|
+
* A method that force reloads the current state, or a partial state hierarchy.
|
|
99
|
+
* All resolves are re-resolved, and components reinstantiated.
|
|
100
|
+
*
|
|
101
|
+
* #### Example:
|
|
102
|
+
* ```js
|
|
103
|
+
* let app angular.module('app', ['ui.router']);
|
|
104
|
+
*
|
|
105
|
+
* app.controller('ctrl', function ($scope, $state) {
|
|
106
|
+
* $scope.reload = function(){
|
|
107
|
+
* $state.reload();
|
|
108
|
+
* }
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* Note: `reload()` is just an alias for:
|
|
113
|
+
*
|
|
114
|
+
* ```js
|
|
115
|
+
* $state.transitionTo($state.current, $state.params, {
|
|
116
|
+
* reload: true, inherit: false
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @param reloadState A state name or a state object.
|
|
121
|
+
* If present, this state and all its children will be reloaded, but ancestors will not reload.
|
|
122
|
+
*
|
|
123
|
+
* #### Example:
|
|
124
|
+
* ```js
|
|
125
|
+
* //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'
|
|
126
|
+
* //and current state is 'contacts.detail.item'
|
|
127
|
+
* let app angular.module('app', ['ui.router']);
|
|
128
|
+
*
|
|
129
|
+
* app.controller('ctrl', function ($scope, $state) {
|
|
130
|
+
* $scope.reload = function(){
|
|
131
|
+
* //will reload 'contact.detail' and nested 'contact.detail.item' states
|
|
132
|
+
* $state.reload('contact.detail');
|
|
133
|
+
* }
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @returns A promise representing the state of the new transition. See [[StateService.go]]
|
|
138
|
+
*/
|
|
139
|
+
reload(reloadState?: StateOrName): Promise<StateObject>;
|
|
140
|
+
/**
|
|
141
|
+
* Transition to a different state and/or parameters
|
|
142
|
+
*
|
|
143
|
+
* Convenience method for transitioning to a new state.
|
|
144
|
+
*
|
|
145
|
+
* `$state.go` calls `$state.transitionTo` internally but automatically sets options to
|
|
146
|
+
* `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.
|
|
147
|
+
* This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).
|
|
148
|
+
* It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters
|
|
149
|
+
* inherit from the current parameter values (because of `inherit: true`).
|
|
150
|
+
*
|
|
151
|
+
* #### Example:
|
|
152
|
+
* ```js
|
|
153
|
+
* let app = angular.module('app', ['ui.router']);
|
|
154
|
+
*
|
|
155
|
+
* app.controller('ctrl', function ($scope, $state) {
|
|
156
|
+
* $scope.changeState = function () {
|
|
157
|
+
* $state.go('contact.detail');
|
|
158
|
+
* };
|
|
159
|
+
* });
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @param to Absolute state name, state object, or relative state path (relative to current state).
|
|
163
|
+
*
|
|
164
|
+
* Some examples:
|
|
165
|
+
*
|
|
166
|
+
* - `$state.go('contact.detail')` - will go to the `contact.detail` state
|
|
167
|
+
* - `$state.go('^')` - will go to the parent state
|
|
168
|
+
* - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state
|
|
169
|
+
* - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state
|
|
170
|
+
*
|
|
171
|
+
* @param params A map of the parameters that will be sent to the state, will populate $stateParams.
|
|
172
|
+
*
|
|
173
|
+
* Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).
|
|
174
|
+
* This allows, for example, going to a sibling state that shares parameters defined by a parent state.
|
|
175
|
+
*
|
|
176
|
+
* @param options Transition options
|
|
177
|
+
*
|
|
178
|
+
* @returns {promise} A promise representing the state of the new transition.
|
|
179
|
+
*/
|
|
180
|
+
go(
|
|
181
|
+
to: StateOrName,
|
|
182
|
+
params?: RawParams,
|
|
183
|
+
options?: TransitionOptions,
|
|
184
|
+
): TransitionPromise;
|
|
185
|
+
/**
|
|
186
|
+
* Creates a [[TargetState]]
|
|
187
|
+
*
|
|
188
|
+
* This is a factory method for creating a TargetState
|
|
189
|
+
*
|
|
190
|
+
* This may be returned from a Transition Hook to redirect a transition, for example.
|
|
191
|
+
*/
|
|
192
|
+
target(
|
|
193
|
+
identifier: StateOrName,
|
|
194
|
+
params?: RawParams,
|
|
195
|
+
options?: TransitionOptions,
|
|
196
|
+
): TargetState;
|
|
197
|
+
/** @internal */
|
|
198
|
+
private getCurrentPath;
|
|
199
|
+
/**
|
|
200
|
+
* Low-level method for transitioning to a new state.
|
|
201
|
+
*
|
|
202
|
+
* The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.
|
|
203
|
+
*
|
|
204
|
+
* #### Example:
|
|
205
|
+
* ```js
|
|
206
|
+
* let app = angular.module('app', ['ui.router']);
|
|
207
|
+
*
|
|
208
|
+
* app.controller('ctrl', function ($scope, $state) {
|
|
209
|
+
* $scope.changeState = function () {
|
|
210
|
+
* $state.transitionTo('contact.detail');
|
|
211
|
+
* };
|
|
212
|
+
* });
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* @param to State name or state object.
|
|
216
|
+
* @param toParams A map of the parameters that will be sent to the state,
|
|
217
|
+
* will populate $stateParams.
|
|
218
|
+
* @param options Transition options
|
|
219
|
+
*
|
|
220
|
+
* @returns A promise representing the state of the new transition. See [[go]]
|
|
221
|
+
*/
|
|
222
|
+
transitionTo(
|
|
223
|
+
to: StateOrName,
|
|
224
|
+
toParams?: RawParams,
|
|
225
|
+
options?: TransitionOptions,
|
|
226
|
+
): TransitionPromise;
|
|
227
|
+
/**
|
|
228
|
+
* Checks if the current state *is* the provided state
|
|
229
|
+
*
|
|
230
|
+
* Similar to [[includes]] but only checks for the full state name.
|
|
231
|
+
* If params is supplied then it will be tested for strict equality against the current
|
|
232
|
+
* active params object, so all params must match with none missing and no extras.
|
|
233
|
+
*
|
|
234
|
+
* #### Example:
|
|
235
|
+
* ```js
|
|
236
|
+
* $state.$current.name = 'contacts.details.item';
|
|
237
|
+
*
|
|
238
|
+
* // absolute name
|
|
239
|
+
* $state.is('contact.details.item'); // returns true
|
|
240
|
+
* $state.is(contactDetailItemStateObject); // returns true
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* // relative name (. and ^), typically from a template
|
|
244
|
+
* // E.g. from the 'contacts.details' template
|
|
245
|
+
* ```html
|
|
246
|
+
* <div ng-class="{highlighted: $state.is('.item')}">Item</div>
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* @param stateOrName The state name (absolute or relative) or state object you'd like to check.
|
|
250
|
+
* @param params A param object, e.g. `{sectionId: section.id}`, that you'd like
|
|
251
|
+
* to test against the current active state.
|
|
252
|
+
* @param options An options object. The options are:
|
|
253
|
+
* - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will
|
|
254
|
+
* test relative to `options.relative` state (or name).
|
|
255
|
+
*
|
|
256
|
+
* @returns Returns true if it is the state.
|
|
257
|
+
*/
|
|
258
|
+
is(
|
|
259
|
+
stateOrName: StateOrName,
|
|
260
|
+
params?: RawParams,
|
|
261
|
+
options?: {
|
|
262
|
+
relative?: StateOrName;
|
|
263
|
+
},
|
|
264
|
+
): boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Checks if the current state *includes* the provided state
|
|
267
|
+
*
|
|
268
|
+
* A method to determine if the current active state is equal to or is the child of the
|
|
269
|
+
* state stateName. If any params are passed then they will be tested for a match as well.
|
|
270
|
+
* Not all the parameters need to be passed, just the ones you'd like to test for equality.
|
|
271
|
+
*
|
|
272
|
+
* #### Example when `$state.$current.name === 'contacts.details.item'`
|
|
273
|
+
* ```js
|
|
274
|
+
* // Using partial names
|
|
275
|
+
* $state.includes("contacts"); // returns true
|
|
276
|
+
* $state.includes("contacts.details"); // returns true
|
|
277
|
+
* $state.includes("contacts.details.item"); // returns true
|
|
278
|
+
* $state.includes("contacts.list"); // returns false
|
|
279
|
+
* $state.includes("about"); // returns false
|
|
280
|
+
* ```
|
|
281
|
+
*
|
|
282
|
+
* #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:
|
|
283
|
+
* ```js
|
|
284
|
+
* $state.includes("*.details.*.*"); // returns true
|
|
285
|
+
* $state.includes("*.details.**"); // returns true
|
|
286
|
+
* $state.includes("**.item.**"); // returns true
|
|
287
|
+
* $state.includes("*.details.item.url"); // returns true
|
|
288
|
+
* $state.includes("*.details.*.url"); // returns true
|
|
289
|
+
* $state.includes("*.details.*"); // returns false
|
|
290
|
+
* $state.includes("item.**"); // returns false
|
|
291
|
+
* ```
|
|
292
|
+
*
|
|
293
|
+
* @param stateOrName A partial name, relative name, glob pattern,
|
|
294
|
+
* or state object to be searched for within the current state name.
|
|
295
|
+
* @param params A param object, e.g. `{sectionId: section.id}`,
|
|
296
|
+
* that you'd like to test against the current active state.
|
|
297
|
+
* @param options An options object. The options are:
|
|
298
|
+
* - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will
|
|
299
|
+
* test relative to `options.relative` state (or name).
|
|
300
|
+
*
|
|
301
|
+
* @returns {boolean} Returns true if it does include the state
|
|
302
|
+
*/
|
|
303
|
+
includes(
|
|
304
|
+
stateOrName: StateOrName,
|
|
305
|
+
params?: RawParams,
|
|
306
|
+
options?: TransitionOptions,
|
|
307
|
+
): boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Generates a URL for a state and parameters
|
|
310
|
+
*
|
|
311
|
+
* Returns the url for the given state populated with the given params.
|
|
312
|
+
*
|
|
313
|
+
* #### Example:
|
|
314
|
+
* ```js
|
|
315
|
+
* expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob");
|
|
316
|
+
* ```
|
|
317
|
+
*
|
|
318
|
+
* @param stateOrName The state name or state object you'd like to generate a url from.
|
|
319
|
+
* @param params An object of parameter values to fill the state's required parameters.
|
|
320
|
+
* @param options Options object. The options are:
|
|
321
|
+
*
|
|
322
|
+
* @returns {string} compiled state url
|
|
323
|
+
*/
|
|
324
|
+
href(
|
|
325
|
+
stateOrName: StateOrName,
|
|
326
|
+
params?: RawParams,
|
|
327
|
+
options?: HrefOptions,
|
|
328
|
+
): string;
|
|
329
|
+
/** @internal */
|
|
330
|
+
private _defaultErrorHandler;
|
|
331
|
+
/**
|
|
332
|
+
* Sets or gets the default [[transitionTo]] error handler.
|
|
333
|
+
*
|
|
334
|
+
* The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.
|
|
335
|
+
* This includes errors caused by resolves and transition hooks.
|
|
336
|
+
*
|
|
337
|
+
* Note:
|
|
338
|
+
* This handler does not receive certain Transition rejections.
|
|
339
|
+
* Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].
|
|
340
|
+
*
|
|
341
|
+
* The built-in default error handler logs the error to the console.
|
|
342
|
+
*
|
|
343
|
+
* You can provide your own custom handler.
|
|
344
|
+
*
|
|
345
|
+
* #### Example:
|
|
346
|
+
* ```js
|
|
347
|
+
* stateService.defaultErrorHandler(function() {
|
|
348
|
+
* // Do not log transitionTo errors
|
|
349
|
+
* });
|
|
350
|
+
* ```
|
|
351
|
+
*
|
|
352
|
+
* @param handler a global error handler function
|
|
353
|
+
* @returns the current global error handler
|
|
354
|
+
*/
|
|
355
|
+
defaultErrorHandler(handler?: (error: any) => void): (error: any) => void;
|
|
356
|
+
/**
|
|
357
|
+
* Gets a registered [[StateDeclaration]] object
|
|
358
|
+
*
|
|
359
|
+
* Returns the state declaration object for any specific state, or for all registered states.
|
|
360
|
+
*
|
|
361
|
+
* @param stateOrName (absolute or relative) If provided, will only get the declaration object for the requested state.
|
|
362
|
+
* If not provided, returns an array of ALL states.
|
|
363
|
+
* @param base When `stateOrName` is a relative state reference (such as `.bar.baz`), the state will be retrieved relative to this state.
|
|
364
|
+
*
|
|
365
|
+
* @returns a [[StateDeclaration]] object (or array of all registered [[StateDeclaration]] objects.)
|
|
366
|
+
* @deprecated use [[StateRegistry.get]]
|
|
367
|
+
*/
|
|
368
|
+
get(stateOrName: StateOrName, base: StateOrName): StateDeclaration;
|
|
369
|
+
get(stateOrName: StateOrName): StateDeclaration;
|
|
370
|
+
get(): StateDeclaration[];
|
|
371
|
+
/**
|
|
372
|
+
* Lazy loads a state
|
|
373
|
+
*
|
|
374
|
+
* Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.
|
|
375
|
+
*
|
|
376
|
+
* @param stateOrName the state that should be lazy loaded
|
|
377
|
+
* @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)
|
|
378
|
+
* Note: If no transition is provided, a noop transition is created using the from the current state to the current state.
|
|
379
|
+
* This noop transition is not actually run.
|
|
380
|
+
*
|
|
381
|
+
* @returns a promise to lazy load
|
|
382
|
+
*/
|
|
383
|
+
lazyLoad(
|
|
384
|
+
stateOrName: StateOrName,
|
|
385
|
+
transition?: Transition,
|
|
386
|
+
): Promise<LazyLoadResult>;
|
|
350
387
|
}
|