@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,5 +1,11 @@
|
|
|
1
1
|
/** @publicapi @module ng1 */ /** */
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
StateDeclaration,
|
|
4
|
+
_ViewDeclaration,
|
|
5
|
+
IInjectable,
|
|
6
|
+
Transition,
|
|
7
|
+
HookResult,
|
|
8
|
+
} from "./core";
|
|
3
9
|
/**
|
|
4
10
|
* The signature for Angular 1 State Transition Hooks.
|
|
5
11
|
*
|
|
@@ -40,7 +46,7 @@ import { StateDeclaration, _ViewDeclaration, IInjectable, Transition, HookResult
|
|
|
40
46
|
* @returns an optional [[HookResult]] which may alter the transition
|
|
41
47
|
*/
|
|
42
48
|
export interface Ng1StateTransitionHook {
|
|
43
|
-
|
|
49
|
+
(...injectables: any[]): HookResult;
|
|
44
50
|
}
|
|
45
51
|
/**
|
|
46
52
|
* @internalapi
|
|
@@ -48,10 +54,10 @@ export interface Ng1StateTransitionHook {
|
|
|
48
54
|
*
|
|
49
55
|
* Used to reset [[StateDeclaration]] typings to `any` so the [[Ng1StateDeclaration]] interface can then narrow them */
|
|
50
56
|
export interface _Ng1StateDeclaration extends StateDeclaration {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
onExit?: any;
|
|
58
|
+
onRetain?: any;
|
|
59
|
+
onEnter?: any;
|
|
60
|
+
views?: any;
|
|
55
61
|
}
|
|
56
62
|
/**
|
|
57
63
|
* The StateDeclaration object is used to define a state or nested state.
|
|
@@ -118,250 +124,250 @@ export interface _Ng1StateDeclaration extends StateDeclaration {
|
|
|
118
124
|
* }
|
|
119
125
|
* ```
|
|
120
126
|
*/
|
|
121
|
-
export interface Ng1StateDeclaration
|
|
122
|
-
|
|
123
|
-
}
|
|
127
|
+
export interface Ng1StateDeclaration
|
|
128
|
+
extends _Ng1StateDeclaration,
|
|
129
|
+
Ng1ViewDeclaration {}
|
|
124
130
|
export interface Ng1ViewDeclaration extends _ViewDeclaration {
|
|
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
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
131
|
+
/**
|
|
132
|
+
* The name of the component to use for this view.
|
|
133
|
+
*
|
|
134
|
+
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
135
|
+
*
|
|
136
|
+
* The name of an [angular 1.5+ `.component()`](https://docs.angularjs.org/guide/component) (or directive with
|
|
137
|
+
* bindToController and/or scope declaration) which will be used for this view.
|
|
138
|
+
*
|
|
139
|
+
* Resolve data can be provided to the component via the component's `bindings` object (for 1.3+ directives, the
|
|
140
|
+
* `bindToController` is used; for other directives, the `scope` declaration is used). For each binding declared
|
|
141
|
+
* on the component, any resolve with the same name is set on the component's controller instance. The binding
|
|
142
|
+
* is provided to the component as a one-time-binding. In general, components should likewise declare their
|
|
143
|
+
* input bindings as [one-way ("<")](https://docs.angularjs.org/api/ng/service/$compile#-scope-).
|
|
144
|
+
*
|
|
145
|
+
* Note: inside a "views:" block, a bare string `"foo"` is shorthand for `{ component: "foo" }`
|
|
146
|
+
*
|
|
147
|
+
* Note: Mapping from resolve names to component inputs may be specified using [[bindings]].
|
|
148
|
+
*
|
|
149
|
+
* #### Example:
|
|
150
|
+
* ```js
|
|
151
|
+
* .state('profile', {
|
|
152
|
+
* // Use the <my-profile></my-profile> component for the Unnamed view
|
|
153
|
+
* component: 'MyProfile',
|
|
154
|
+
* }
|
|
155
|
+
*
|
|
156
|
+
* .state('messages', {
|
|
157
|
+
* // use the <nav-bar></nav-bar> component for the view named 'header'
|
|
158
|
+
* // use the <message-list></message-list> component for the view named 'content'
|
|
159
|
+
* views: {
|
|
160
|
+
* header: { component: 'NavBar' },
|
|
161
|
+
* content: { component: 'MessageList' }
|
|
162
|
+
* }
|
|
163
|
+
* }
|
|
164
|
+
*
|
|
165
|
+
* .state('contacts', {
|
|
166
|
+
* // Inside a "views:" block, a bare string "NavBar" is shorthand for { component: "NavBar" }
|
|
167
|
+
* // use the <nav-bar></nav-bar> component for the view named 'header'
|
|
168
|
+
* // use the <contact-list></contact-list> component for the view named 'content'
|
|
169
|
+
* views: {
|
|
170
|
+
* header: 'NavBar',
|
|
171
|
+
* content: 'ContactList'
|
|
172
|
+
* }
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
*
|
|
177
|
+
* Note: When using `component` to define a view, you may _not_ use any of: `template`, `templateUrl`,
|
|
178
|
+
* `templateProvider`, `controller`, `controllerProvider`, `controllerAs`.
|
|
179
|
+
*
|
|
180
|
+
*
|
|
181
|
+
* See also: Todd Motto's angular 1.3 and 1.4 [backport of .component()](https://github.com/toddmotto/angular-component)
|
|
182
|
+
*/
|
|
183
|
+
component?: string;
|
|
184
|
+
/**
|
|
185
|
+
* An object which maps `resolve`s to [[component]] `bindings`.
|
|
186
|
+
*
|
|
187
|
+
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
188
|
+
*
|
|
189
|
+
* When using a [[component]] declaration (`component: 'myComponent'`), each input binding for the component is supplied
|
|
190
|
+
* data from a resolve of the same name, by default. You may supply data from a different resolve name by mapping it here.
|
|
191
|
+
*
|
|
192
|
+
* Each key in this object is the name of one of the component's input bindings.
|
|
193
|
+
* Each value is the name of the resolve that should be provided to that binding.
|
|
194
|
+
*
|
|
195
|
+
* Any component bindings that are omitted from this map get the default behavior of mapping to a resolve of the
|
|
196
|
+
* same name.
|
|
197
|
+
*
|
|
198
|
+
* #### Example:
|
|
199
|
+
* ```js
|
|
200
|
+
* $stateProvider.state('foo', {
|
|
201
|
+
* resolve: {
|
|
202
|
+
* foo: function(FooService) { return FooService.get(); },
|
|
203
|
+
* bar: function(BarService) { return BarService.get(); }
|
|
204
|
+
* },
|
|
205
|
+
* component: 'Baz',
|
|
206
|
+
* // The component's `baz` binding gets data from the `bar` resolve
|
|
207
|
+
* // The component's `foo` binding gets data from the `foo` resolve (default behavior)
|
|
208
|
+
* bindings: {
|
|
209
|
+
* baz: 'bar'
|
|
210
|
+
* }
|
|
211
|
+
* });
|
|
212
|
+
*
|
|
213
|
+
* app.component('Baz', {
|
|
214
|
+
* templateUrl: 'baz.html',
|
|
215
|
+
* controller: 'BazController',
|
|
216
|
+
* bindings: {
|
|
217
|
+
* foo: '<', // foo binding
|
|
218
|
+
* baz: '<' // baz binding
|
|
219
|
+
* }
|
|
220
|
+
* });
|
|
221
|
+
* ```
|
|
222
|
+
*
|
|
223
|
+
*/
|
|
224
|
+
bindings?: {
|
|
225
|
+
[key: string]: string;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Dynamic component provider function.
|
|
229
|
+
*
|
|
230
|
+
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
231
|
+
*
|
|
232
|
+
* This is an injectable provider function which returns the name of the component to use.
|
|
233
|
+
* The provider will invoked during a Transition in which the view's state is entered.
|
|
234
|
+
* The provider is called after the resolve data is fetched.
|
|
235
|
+
*
|
|
236
|
+
* #### Example:
|
|
237
|
+
* ```js
|
|
238
|
+
* componentProvider: function(MyResolveData, $transition$) {
|
|
239
|
+
* if (MyResolveData.foo) {
|
|
240
|
+
* return "fooComponent"
|
|
241
|
+
* } else if ($transition$.to().name === 'bar') {
|
|
242
|
+
* return "barComponent";
|
|
243
|
+
* }
|
|
244
|
+
* }
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
componentProvider?: IInjectable;
|
|
248
|
+
/**
|
|
249
|
+
* The view's controller function or name
|
|
250
|
+
*
|
|
251
|
+
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
252
|
+
*
|
|
253
|
+
* The controller function, or the name of a registered controller. The controller function will be used
|
|
254
|
+
* to control the contents of the [[directives.uiView]] directive.
|
|
255
|
+
*
|
|
256
|
+
* If specified as a string, controllerAs can be declared here, i.e., "FooController as foo" instead of in
|
|
257
|
+
* a separate [[controllerAs]] property.
|
|
258
|
+
*
|
|
259
|
+
* See: [[Ng1Controller]] for information about component-level router hooks.
|
|
260
|
+
*/
|
|
261
|
+
controller?: IInjectable | string;
|
|
262
|
+
/**
|
|
263
|
+
* A controller alias name.
|
|
264
|
+
*
|
|
265
|
+
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
266
|
+
*
|
|
267
|
+
* If present, the controller will be published to scope under the `controllerAs` name.
|
|
268
|
+
* See: https://docs.angularjs.org/api/ng/directive/ngController
|
|
269
|
+
*/
|
|
270
|
+
controllerAs?: string;
|
|
271
|
+
/**
|
|
272
|
+
* Dynamic controller provider function.
|
|
273
|
+
*
|
|
274
|
+
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
275
|
+
*
|
|
276
|
+
* This is an injectable provider function which returns the actual controller function, or the name
|
|
277
|
+
* of a registered controller. The provider will invoked during a Transition in which the view's state is
|
|
278
|
+
* entered. The provider is called after the resolve data is fetched.
|
|
279
|
+
*
|
|
280
|
+
* #### Example:
|
|
281
|
+
* ```js
|
|
282
|
+
* controllerProvider: function(MyResolveData, $transition$) {
|
|
283
|
+
* if (MyResolveData.foo) {
|
|
284
|
+
* return "FooCtrl"
|
|
285
|
+
* } else if ($transition$.to().name === 'bar') {
|
|
286
|
+
* return "BarCtrl";
|
|
287
|
+
* } else {
|
|
288
|
+
* return function($scope) {
|
|
289
|
+
* $scope.baz = "Qux";
|
|
290
|
+
* }
|
|
291
|
+
* }
|
|
292
|
+
* }
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
controllerProvider?: IInjectable;
|
|
296
|
+
/**
|
|
297
|
+
* The scope variable name to use for resolve data.
|
|
298
|
+
*
|
|
299
|
+
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
300
|
+
*
|
|
301
|
+
* When a view is activated, the resolved data for the state which the view belongs to is put on the scope.
|
|
302
|
+
* This property sets the name of the scope variable to use for the resolved data.
|
|
303
|
+
*
|
|
304
|
+
* Defaults to `$resolve`.
|
|
305
|
+
*/
|
|
306
|
+
resolveAs?: string;
|
|
307
|
+
/**
|
|
308
|
+
* The HTML template for the view.
|
|
309
|
+
*
|
|
310
|
+
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
311
|
+
*
|
|
312
|
+
* HTML template as a string, or a function which returns an html template as a string.
|
|
313
|
+
* This template will be used to render the corresponding [[directives.uiView]] directive.
|
|
314
|
+
*
|
|
315
|
+
* This property takes precedence over templateUrl.
|
|
316
|
+
*
|
|
317
|
+
* If `template` is a function, it will be called with the Transition parameters as the first argument.
|
|
318
|
+
*
|
|
319
|
+
* #### Example:
|
|
320
|
+
* ```js
|
|
321
|
+
* template: "<h1>inline template definition</h1><div ui-view></div>"
|
|
322
|
+
* ```
|
|
323
|
+
*
|
|
324
|
+
* #### Example:
|
|
325
|
+
* ```js
|
|
326
|
+
* template: function(params) {
|
|
327
|
+
* return "<h1>generated template</h1>";
|
|
328
|
+
* }
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
template?: Function | string;
|
|
332
|
+
/**
|
|
333
|
+
* The URL for the HTML template for the view.
|
|
334
|
+
*
|
|
335
|
+
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
336
|
+
*
|
|
337
|
+
* A path or a function that returns a path to an html template.
|
|
338
|
+
* The template will be fetched and used to render the corresponding [[directives.uiView]] directive.
|
|
339
|
+
*
|
|
340
|
+
* If `templateUrl` is a function, it will be called with the Transition parameters as the first argument.
|
|
341
|
+
*
|
|
342
|
+
* #### Example:
|
|
343
|
+
* ```js
|
|
344
|
+
* templateUrl: "/templates/home.html"
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* #### Example:
|
|
348
|
+
* ```js
|
|
349
|
+
* templateUrl: function(params) {
|
|
350
|
+
* return myTemplates[params.pageId];
|
|
351
|
+
* }
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
templateUrl?: string | Function;
|
|
355
|
+
/**
|
|
356
|
+
* Injected function which returns the HTML template.
|
|
357
|
+
*
|
|
358
|
+
* A property of [[Ng1StateDeclaration]] or [[Ng1ViewDeclaration]]:
|
|
359
|
+
*
|
|
360
|
+
* Injected function which returns the HTML template.
|
|
361
|
+
* The template will be used to render the corresponding [[directives.uiView]] directive.
|
|
362
|
+
*
|
|
363
|
+
* #### Example:
|
|
364
|
+
* ```js
|
|
365
|
+
* templateProvider: function(MyTemplateService, $transition$) {
|
|
366
|
+
* return MyTemplateService.getTemplate($transition$.params().pageId);
|
|
367
|
+
* }
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
templateProvider?: IInjectable;
|
|
365
371
|
}
|
|
366
372
|
/**
|
|
367
373
|
* The shape of a controller for a view (and/or component), defining the controller callbacks.
|
|
@@ -377,81 +383,81 @@ export interface Ng1ViewDeclaration extends _ViewDeclaration {
|
|
|
377
383
|
*
|
|
378
384
|
*/
|
|
379
385
|
export interface Ng1Controller {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
386
|
+
/** @hidden */
|
|
387
|
+
$onInit(): void;
|
|
388
|
+
/**
|
|
389
|
+
* This callback is called when parameter values have changed.
|
|
390
|
+
*
|
|
391
|
+
* This callback can be used to respond to changing parameter values in the current state, or in parent/child states.
|
|
392
|
+
* This callback is especially handy when using dynamic parameters ([[ParamDeclaration.dynamic]])
|
|
393
|
+
*
|
|
394
|
+
* Called when:
|
|
395
|
+
* - The view is still active
|
|
396
|
+
* - A new transition has completed successfully
|
|
397
|
+
* - The state for the view (controller) was not reloaded
|
|
398
|
+
* - At least one parameter value was changed
|
|
399
|
+
*
|
|
400
|
+
* Called with:
|
|
401
|
+
* @param newValues an object containing the changed parameter values
|
|
402
|
+
* @param $transition$ the new Transition which triggered this callback
|
|
403
|
+
*
|
|
404
|
+
* #### Example:
|
|
405
|
+
* ```js
|
|
406
|
+
* angular.module('foo').controller('FancyCtrl', function() {
|
|
407
|
+
* this.uiOnParamsChanged = function(newParams) {
|
|
408
|
+
* console.log("new params: ", newParams);
|
|
409
|
+
* }
|
|
410
|
+
* });
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
uiOnParamsChanged(newValues: any, $transition$: Transition): void;
|
|
414
|
+
/**
|
|
415
|
+
* This callback is called when the view's state is about to be exited.
|
|
416
|
+
*
|
|
417
|
+
* This callback is used to inform a view that it is about to be exited, due to a new [[Transition]].
|
|
418
|
+
* The callback can ask for user confirmation, and cancel or alter the new Transition. The callback should
|
|
419
|
+
* return a value, or a promise for a value. If a promise is returned, the new Transition waits until the
|
|
420
|
+
* promise settles.
|
|
421
|
+
*
|
|
422
|
+
*
|
|
423
|
+
* Called when:
|
|
424
|
+
* - The view is still active
|
|
425
|
+
* - A new Transition is about to run
|
|
426
|
+
* - The new Transition will exit the view's state
|
|
427
|
+
*
|
|
428
|
+
* Called with:
|
|
429
|
+
* - The new Transition
|
|
430
|
+
*
|
|
431
|
+
* Relevant return Values:
|
|
432
|
+
* - `false`: The transition is cancelled.
|
|
433
|
+
* - A rejected promise: The transition is cancelled.
|
|
434
|
+
* - [[TargetState]]: The transition is redirected to the new target state.
|
|
435
|
+
* - Anything else: the transition will continue normally (the state and view will be deactivated)
|
|
436
|
+
*
|
|
437
|
+
* #### Example:
|
|
438
|
+
* ```js
|
|
439
|
+
* app.component('myComponent', {
|
|
440
|
+
* template: '<input ng-model="$ctrl.data" type="text">',
|
|
441
|
+
* bindings: { 'data': '<' },
|
|
442
|
+
* controller: function() {
|
|
443
|
+
*
|
|
444
|
+
* this.originalData = angular.copy(this.data);
|
|
445
|
+
*
|
|
446
|
+
* this.uiCanExit = function() {
|
|
447
|
+
* if (!angular.equals(this.data, this.originalData)) {
|
|
448
|
+
* // Note: This could also return a Promise and request async
|
|
449
|
+
* // confirmation using something like ui-bootstrap $modal
|
|
450
|
+
* return window.confirm("Data has changed. Exit anyway and lose changes?");
|
|
451
|
+
* }
|
|
452
|
+
* }
|
|
453
|
+
* }
|
|
454
|
+
* }
|
|
455
|
+
* ```
|
|
456
|
+
*
|
|
457
|
+
* @param transition the new Transition that is about to exit the component's state
|
|
458
|
+
* @return a HookResult, or a promise for a HookResult
|
|
459
|
+
*/
|
|
460
|
+
uiCanExit(transition: Transition): HookResult;
|
|
455
461
|
}
|
|
456
462
|
/**
|
|
457
463
|
* Manages which template-loading mechanism to use.
|
|
@@ -459,33 +465,37 @@ export interface Ng1Controller {
|
|
|
459
465
|
* Defaults to `$templateRequest` on Angular versions starting from 1.3, `$http` otherwise.
|
|
460
466
|
*/
|
|
461
467
|
export interface TemplateFactoryProvider {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
468
|
+
/**
|
|
469
|
+
* Forces $templateFactory to use $http instead of $templateRequest.
|
|
470
|
+
*
|
|
471
|
+
* UI-Router uses `$templateRequest` by default on angular 1.3+.
|
|
472
|
+
* Use this method to choose to use `$http` instead.
|
|
473
|
+
*
|
|
474
|
+
* ---
|
|
475
|
+
*
|
|
476
|
+
* ## Security warning
|
|
477
|
+
*
|
|
478
|
+
* This might cause XSS, as $http doesn't enforce the regular security checks for
|
|
479
|
+
* templates that have been introduced in Angular 1.3.
|
|
480
|
+
*
|
|
481
|
+
* See the $sce documentation, section
|
|
482
|
+
* <a href="https://docs.angularjs.org/api/ng/service/$sce#impact-on-loading-templates">
|
|
483
|
+
* Impact on loading templates</a> for more details about this mechanism.
|
|
484
|
+
*
|
|
485
|
+
* *Note: forcing this to `false` on Angular 1.2.x will crash, because `$templateRequest` is not implemented.*
|
|
486
|
+
*
|
|
487
|
+
* @param useUnsafeHttpService `true` to use `$http` to fetch templates
|
|
488
|
+
*/
|
|
489
|
+
useHttpService(useUnsafeHttpService: boolean): any;
|
|
484
490
|
}
|
|
485
|
-
declare module
|
|
486
|
-
|
|
487
|
-
|
|
491
|
+
declare module "@uirouter/core/lib/state/stateRegistry" {
|
|
492
|
+
interface StateRegistry {
|
|
493
|
+
register(
|
|
494
|
+
state:
|
|
495
|
+
| Ng1StateDeclaration
|
|
496
|
+
| {
|
|
488
497
|
new (): Ng1StateDeclaration;
|
|
489
|
-
|
|
490
|
-
|
|
498
|
+
},
|
|
499
|
+
): any;
|
|
500
|
+
}
|
|
491
501
|
}
|