@angular-wave/angular.ts 0.0.60 → 0.0.62

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.
Files changed (128) hide show
  1. package/README.md +1 -1
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -2
  4. package/package.json +2 -1
  5. package/src/angular.spec.js +2 -2
  6. package/src/core/parser/parse.js +14 -0
  7. package/src/core/parser/parse.spec.js +7 -5
  8. package/src/core/parser/parser.js +1 -1
  9. package/src/core/q/q.js +46 -289
  10. package/src/core/q/q.md +229 -0
  11. package/src/core/sanitize/sanitize-uri.js +2 -3
  12. package/src/core/scope/scope.js +18 -8
  13. package/src/directive/if/if.js +6 -1
  14. package/src/filters/limit-to.js +5 -2
  15. package/src/filters/order-by.js +1 -2
  16. package/src/index.js +1 -1
  17. package/src/loader.js +1 -55
  18. package/src/router/params/param-type.js +2 -1
  19. package/src/router/state/views.js +3 -0
  20. package/src/router/state-provider.js +1 -1
  21. package/src/router/transition/reject-factory.js +1 -0
  22. package/src/router/url/url-rule.js +1 -1
  23. package/src/router/url/url-service.js +4 -4
  24. package/src/router/url/url-service.spec.js +4 -3
  25. package/src/services/http/http.js +7 -5
  26. package/src/services/template-request.js +2 -7
  27. package/src/shared/common.js +1 -1
  28. package/src/shared/utils.js +2 -11
  29. package/src/types.js +9 -1
  30. package/types/core/parser/parse.d.ts +3 -4
  31. package/types/core/parser/parser.d.ts +1 -1
  32. package/types/core/q/q.d.ts +2 -2
  33. package/types/core/sanitize/sanitize-uri.d.ts +4 -5
  34. package/types/core/scope/scope.d.ts +19 -7
  35. package/types/index.d.ts +5 -1
  36. package/types/loader.d.ts +0 -52
  37. package/types/router/params/param-type.d.ts +2 -1
  38. package/types/router/state/views.d.ts +2 -0
  39. package/types/router/state-provider.d.ts +1 -1
  40. package/types/router/transition/reject-factory.d.ts +1 -0
  41. package/types/router/url/url-rule.d.ts +0 -1
  42. package/types/router/url/url-service.d.ts +7 -7
  43. package/types/services/template-request.d.ts +4 -9
  44. package/types/shared/utils.d.ts +1 -7
  45. package/types/types.d.ts +6 -1
  46. package/types-back/README.md +0 -2
  47. package/types-back/angular.d.ts +0 -146
  48. package/types-back/index.d.ts +0 -2126
  49. package/types-back/jqlite.d.ts +0 -374
  50. package/types-back/router/core/common/common.d.ts +0 -416
  51. package/types-back/router/core/common/coreservices.d.ts +0 -77
  52. package/types-back/router/core/common/glob.d.ts +0 -60
  53. package/types-back/router/core/common/hof.d.ts +0 -168
  54. package/types-back/router/core/common/index.d.ts +0 -8
  55. package/types-back/router/core/common/predicates.d.ts +0 -25
  56. package/types-back/router/core/common/queue.d.ts +0 -15
  57. package/types-back/router/core/common/safeConsole.d.ts +0 -5
  58. package/types-back/router/core/common/strings.d.ts +0 -66
  59. package/types-back/router/core/common/trace.d.ts +0 -126
  60. package/types-back/router/core/globals.d.ts +0 -43
  61. package/types-back/router/core/hooks/coreResolvables.d.ts +0 -6
  62. package/types-back/router/core/hooks/ignoredTransition.d.ts +0 -4
  63. package/types-back/router/core/hooks/invalidTransition.d.ts +0 -4
  64. package/types-back/router/core/hooks/lazyLoad.d.ts +0 -17
  65. package/types-back/router/core/hooks/onEnterExitRetain.d.ts +0 -10
  66. package/types-back/router/core/hooks/redirectTo.d.ts +0 -4
  67. package/types-back/router/core/hooks/resolve.d.ts +0 -11
  68. package/types-back/router/core/hooks/updateGlobals.d.ts +0 -4
  69. package/types-back/router/core/hooks/url.d.ts +0 -4
  70. package/types-back/router/core/hooks/views.d.ts +0 -7
  71. package/types-back/router/core/index.d.ts +0 -11
  72. package/types-back/router/core/interface.d.ts +0 -91
  73. package/types-back/router/core/params/index.d.ts +0 -12
  74. package/types-back/router/core/params/interface.d.ts +0 -606
  75. package/types-back/router/core/params/param.d.ts +0 -77
  76. package/types-back/router/core/params/paramType.d.ts +0 -65
  77. package/types-back/router/core/params/paramTypes.d.ts +0 -193
  78. package/types-back/router/core/params/stateParams.d.ts +0 -15
  79. package/types-back/router/core/path/index.d.ts +0 -2
  80. package/types-back/router/core/path/pathNode.d.ts +0 -60
  81. package/types-back/router/core/path/pathUtils.d.ts +0 -105
  82. package/types-back/router/core/resolve/index.d.ts +0 -3
  83. package/types-back/router/core/resolve/interface.d.ts +0 -210
  84. package/types-back/router/core/resolve/resolvable.d.ts +0 -75
  85. package/types-back/router/core/resolve/resolveContext.d.ts +0 -97
  86. package/types-back/router/core/router.d.ts +0 -57
  87. package/types-back/router/core/state/index.d.ts +0 -28
  88. package/types-back/router/core/state/interface.d.ts +0 -732
  89. package/types-back/router/core/state/stateBuilder.d.ts +0 -107
  90. package/types-back/router/core/state/stateMatcher.d.ts +0 -13
  91. package/types-back/router/core/state/stateObject.d.ts +0 -170
  92. package/types-back/router/core/state/stateQueueManager.d.ts +0 -27
  93. package/types-back/router/core/state/stateRegistry.d.ts +0 -138
  94. package/types-back/router/core/state/stateService.d.ts +0 -386
  95. package/types-back/router/core/state/targetState.d.ts +0 -105
  96. package/types-back/router/core/transition/hookBuilder.d.ts +0 -49
  97. package/types-back/router/core/transition/hookRegistry.d.ts +0 -115
  98. package/types-back/router/core/transition/index.d.ts +0 -20
  99. package/types-back/router/core/transition/interface.d.ts +0 -862
  100. package/types-back/router/core/transition/rejectFactory.d.ts +0 -103
  101. package/types-back/router/core/transition/transition.d.ts +0 -575
  102. package/types-back/router/core/transition/transitionEventType.d.ts +0 -26
  103. package/types-back/router/core/transition/transitionHook.d.ts +0 -96
  104. package/types-back/router/core/transition/transitionService.d.ts +0 -253
  105. package/types-back/router/core/url/index.d.ts +0 -8
  106. package/types-back/router/core/url/interface.d.ts +0 -169
  107. package/types-back/router/core/url/urlConfig.d.ts +0 -144
  108. package/types-back/router/core/url/urlMatcher.d.ts +0 -185
  109. package/types-back/router/core/url/urlMatcherFactory.d.ts +0 -56
  110. package/types-back/router/core/url/urlRouter.d.ts +0 -101
  111. package/types-back/router/core/url/urlRule.d.ts +0 -143
  112. package/types-back/router/core/url/urlRules.d.ts +0 -251
  113. package/types-back/router/core/url/urlService.d.ts +0 -205
  114. package/types-back/router/core/view/index.d.ts +0 -2
  115. package/types-back/router/core/view/interface.d.ts +0 -46
  116. package/types-back/router/core/view/view.d.ts +0 -176
  117. package/types-back/router/directives/viewDirective.d.ts +0 -144
  118. package/types-back/router/index.d.ts +0 -17
  119. package/types-back/router/interface.d.ts +0 -500
  120. package/types-back/router/legacy/resolveService.d.ts +0 -47
  121. package/types-back/router/legacy/stateEvents.d.ts +0 -124
  122. package/types-back/router/services.d.ts +0 -15
  123. package/types-back/router/stateFilters.d.ts +0 -10
  124. package/types-back/router/stateProvider.d.ts +0 -258
  125. package/types-back/router/statebuilders/onEnterExitRetain.d.ts +0 -13
  126. package/types-back/router/statebuilders/views.d.ts +0 -53
  127. package/types-back/router/templateFactory.d.ts +0 -104
  128. package/types-back/router/viewScroll.d.ts +0 -9
@@ -1,2126 +0,0 @@
1
- /// <reference path="jqlite.d.ts" />
2
- import { IAngularStatic as AngularStatic } from "./angular";
3
-
4
- export * from "./router";
5
- // Support for painless dependency injection
6
- declare global {
7
- interface Function {
8
- $inject?: readonly string[] | undefined;
9
- }
10
- }
11
-
12
- import { Obj } from "./router";
13
-
14
- ///////////////////////////////////////////////////////////////////////////////
15
- // ng module (angular.js)
16
- ///////////////////////////////////////////////////////////////////////////////
17
- declare namespace angular {
18
- type IAngularStatic = AngularStatic;
19
- type Injectable<T extends Function> = T | Array<string | T>;
20
-
21
- // not directly implemented, but ensures that constructed class implements $get
22
- interface IServiceProviderClass {
23
- new (...args: any[]): IServiceProvider;
24
- }
25
-
26
- interface IServiceProviderFactory {
27
- (...args: any[]): IServiceProvider;
28
- }
29
-
30
- ///////////////////////////////////////////////////////////////////////////
31
- // Module
32
- // see http://docs.angularjs.org/api/angular.Module
33
- ///////////////////////////////////////////////////////////////////////////
34
- interface IModule {
35
- /**
36
- * Use this method to register a component.
37
- *
38
- * @param name The name of the component.
39
- * @param options A definition object passed into the component.
40
- */
41
- component(name: string, options: IComponentOptions): IModule;
42
- /**
43
- * Use this method to register a component.
44
- *
45
- * @param object Object map of components where the keys are the names and the values are the component definition objects
46
- */
47
- component(object: { [componentName: string]: IComponentOptions }): IModule;
48
- /**
49
- * Use this method to register work which needs to be performed on module loading.
50
- *
51
- * @param configFn Execute this function on module load. Useful for service configuration.
52
- */
53
- config(configFn: Function): IModule;
54
- /**
55
- * Use this method to register work which needs to be performed on module loading.
56
- *
57
- * @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration.
58
- */
59
- config(inlineAnnotatedFunction: any[]): IModule;
60
- config(object: Object): IModule;
61
- /**
62
- * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator.
63
- *
64
- * @param name The name of the constant.
65
- * @param value The constant value.
66
- */
67
- constant<T>(name: string, value: T): IModule;
68
- constant(object: Object): IModule;
69
- /**
70
- * The $controller service is used by Angular to create new controllers.
71
- *
72
- * This provider allows controller registration via the register method.
73
- *
74
- * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors.
75
- * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation).
76
- */
77
- controller(
78
- name: string,
79
- controllerConstructor: Injectable<IControllerConstructor>,
80
- ): IModule;
81
- controller(object: {
82
- [name: string]: Injectable<IControllerConstructor>;
83
- }): IModule;
84
- /**
85
- * Register a new directive with the compiler.
86
- *
87
- * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
88
- * @param directiveFactory An injectable directive factory function.
89
- */
90
- directive<
91
- TScope extends Scope = Scope,
92
- TElement extends JQLite = JQLite,
93
- TAttributes extends IAttributes = IAttributes,
94
- TController extends IDirectiveController = IController,
95
- >(
96
- name: string,
97
- directiveFactory: Injectable<
98
- IDirectiveFactory<TScope, TElement, TAttributes, TController>
99
- >,
100
- ): IModule;
101
- directive<
102
- TScope extends Scope = Scope,
103
- TElement extends JQLite = JQLite,
104
- TAttributes extends IAttributes = IAttributes,
105
- TController extends IDirectiveController = IController,
106
- >(object: {
107
- [directiveName: string]: Injectable<
108
- IDirectiveFactory<TScope, TElement, TAttributes, TController>
109
- >;
110
- }): IModule;
111
-
112
- /**
113
- * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
114
- *
115
- * @param name The name of the instance.
116
- * @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}).
117
- */
118
- factory(name: string, $getFn: Injectable<Function>): IModule;
119
- factory(object: { [name: string]: Injectable<Function> }): IModule;
120
- filter(
121
- name: string,
122
- filterFactoryFunction: Injectable<FilterFactory>,
123
- ): IModule;
124
- filter(object: { [name: string]: Injectable<FilterFactory> }): IModule;
125
- provider(
126
- name: string,
127
- serviceProviderFactory: IServiceProviderFactory,
128
- ): IModule;
129
- provider(
130
- name: string,
131
- serviceProviderConstructor: IServiceProviderClass,
132
- ): IModule;
133
- provider(name: string, inlineAnnotatedConstructor: any[]): IModule;
134
- provider(name: string, providerObject: IServiceProvider): IModule;
135
- provider(object: Object): IModule;
136
- /**
137
- * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests.
138
- */
139
- run(initializationFuncti Injectable<Function>): IModule;
140
- /**
141
- * Register a service constructor, which will be invoked with new to create the service instance. This is short for registering a service where its provider's $get property is a factory function that returns an instance instantiated by the injector from the service constructor function.
142
- *
143
- * @param name The name of the instance.
144
- * @param serviceConstructor An injectable class (constructor function) that will be instantiated.
145
- */
146
- service(name: string, serviceConstructor: Injectable<Function>): IModule;
147
- service(object: { [name: string]: Injectable<Function> }): IModule;
148
- /**
149
- * Register a value service with the $injector, such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's $get property is a factory function that takes no arguments and returns the value service.
150
-
151
- Value services are similar to constant services, except that they cannot be injected into a module configuration function (see config) but they can be overridden by an Angular decorator.
152
- *
153
- * @param name The name of the instance.
154
- * @param value The value.
155
- */
156
- value<T>(name: string, value: T): IModule;
157
- value(object: Object): IModule;
158
-
159
- /**
160
- * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service.
161
- * @param name The name of the service to decorate
162
- * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
163
- */
164
- decorator(name: string, decorator: Injectable<Function>): IModule;
165
-
166
- // Properties
167
- name: string;
168
- requires: string[];
169
- }
170
-
171
- /**
172
- * form.FormController - type in module ng
173
- * see https://docs.angularjs.org/api/ng/type/form.FormController
174
- */
175
- interface IFormController {
176
- /**
177
- * Indexer which should return ng.INgModelController for most properties but cannot because of "All named properties must be assignable to string indexer type" constraint - see https://github.com/Microsoft/TypeScript/issues/272
178
- */
179
- [name: string]: any;
180
-
181
- $pristine: boolean;
182
- $dirty: boolean;
183
- $valid: boolean;
184
- $invalid: boolean;
185
- $submitted: boolean;
186
- $error: {
187
- [validationErrorKey: string]: Array<INgModelController | IFormController>;
188
- };
189
- $name?: string | undefined;
190
- $pending?:
191
- | {
192
- [validationErrorKey: string]: Array<
193
- INgModelController | IFormController
194
- >;
195
- }
196
- | undefined;
197
- $addControl(control: INgModelController | IFormController): void;
198
- $getControls(): ReadonlyArray<INgModelController | IFormController>;
199
- $removeControl(control: INgModelController | IFormController): void;
200
- $setValidity(
201
- validationErrorKey: string,
202
- isValid: boolean,
203
- control: INgModelController | IFormController,
204
- ): void;
205
- $setDirty(): void;
206
- $setPristine(): void;
207
- $commitViewValue(): void;
208
- $rollbackViewValue(): void;
209
- $setSubmitted(): void;
210
- $setUntouched(): void;
211
- }
212
-
213
- ///////////////////////////////////////////////////////////////////////////
214
- // NgModelController
215
- // see http://docs.angularjs.org/api/ng/type/ngModel.NgModelController
216
- ///////////////////////////////////////////////////////////////////////////
217
- interface INgModelController {
218
- $render(): void;
219
- $setValidity(validationErrorKey: string, isValid: boolean): void;
220
- // Documentation states viewValue and modelValue to be a string but other
221
- // types do work and it's common to use them.
222
- $setViewValue(value: any, trigger?: string): void;
223
- $setPristine(): void;
224
- $setDirty(): void;
225
- $validate(): void;
226
- $setTouched(): void;
227
- $setUntouched(): void;
228
- $rollbackViewValue(): void;
229
- $commitViewValue(): void;
230
- $processModelValue(): void;
231
- $isEmpty(value: any): boolean;
232
- $overrideModelOptions(options: INgModelOptions): void;
233
-
234
- $viewValue: any;
235
-
236
- $modelValue: any;
237
-
238
- $parsers: IModelParser[];
239
- $formatters: IModelFormatter[];
240
- $viewChangeListeners: IModelViewChangeListener[];
241
- $error: { [validationErrorKey: string]: boolean };
242
- $name?: string | undefined;
243
-
244
- $touched: boolean;
245
- $untouched: boolean;
246
-
247
- $validators: IModelValidators;
248
- $asyncValidators: IAsyncModelValidators;
249
-
250
- $pending?: { [validationErrorKey: string]: boolean } | undefined;
251
- $pristine: boolean;
252
- $dirty: boolean;
253
- $valid: boolean;
254
- $invalid: boolean;
255
- }
256
-
257
- interface IModelValidators {
258
- /**
259
- * viewValue is any because it can be an object that is called in the view like $viewValue.name:$viewValue.subName
260
- */
261
- [index: string]: (modelValue: any, viewValue: any) => boolean;
262
- }
263
-
264
- interface IAsyncModelValidators {
265
- [index: string]: (modelValue: any, viewValue: any) => IPromise<any>;
266
- }
267
-
268
- interface IErrorHandlingConfig {
269
- /**
270
- * The max depth for stringifying objects.
271
- * Setting to a non-positive or non-numeric value, removes the max depth limit
272
- * @default 5
273
- */
274
- objectMaxDepth?: number | undefined;
275
- /**
276
- * Specifies whether the generated error url will contain the parameters of the thrown error.
277
- * Disabling the parameters can be useful if the generated error url is very long.
278
- * @default true;
279
- */
280
- urlErrorParamsEnabled?: boolean | undefined;
281
- }
282
-
283
- interface IModelParser {
284
- (value: any): any;
285
- }
286
-
287
- interface IModelFormatter {
288
- (value: any): any;
289
- }
290
-
291
- interface IModelViewChangeListener {
292
- (): void;
293
- }
294
-
295
- /**
296
- * $rootScope - $rootScopeProvider - service in module ng
297
- * see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope
298
- */
299
- class Scope {
300
- $id: number;
301
- $parent: Scope | null;
302
- $root: Scope | null;
303
- $$destroyed: boolean;
304
- $$isolateBindings: any;
305
- $$phase: any;
306
-
307
- $$watchers?: any[];
308
- $$nextSibling: Scope | null;
309
- $$prevSibling: Scope | null;
310
- $$childHead: Scope | null;
311
- $$childTail: Scope | null;
312
- $$ChildScope: Scope | null;
313
- $$watchersCount: number;
314
- $$digestWatchIndex: number;
315
- $$suspended: boolean;
316
-
317
- $$listeners: Object;
318
- $$listenerCount: Object;
319
-
320
- $apply(): any;
321
- $apply(expr: string): any;
322
- $apply(expr: (scope: Scope) => any): any;
323
-
324
- $applyAsync(): any;
325
- $applyAsync(exp: string): any;
326
- $applyAsync(exp: (scope: Scope) => any): any;
327
-
328
- /**
329
- * Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners.
330
- *
331
- * The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled.
332
- *
333
- * Any exception emitted from the listeners will be passed onto the $exceptionHandler service.
334
- *
335
- * @param name Event name to broadcast.
336
- * @param args Optional one or more arguments which will be passed onto the event listeners.
337
- */
338
- $broadcast(name: string, ...args: any[]): IAngularEvent;
339
- private beginPhase(number): void;
340
- private clearPhase(): void;
341
- private $$postDigest(): void;
342
- private incrementWatchersCount(number): void;
343
- private decrementListenerCount(number, string): void;
344
- $destroy(): void;
345
- $digest(): void;
346
-
347
- /**
348
- * Suspend watchers of this scope subtree so that they will not be invoked during digest.
349
- *
350
- * This can be used to optimize your application when you know that running those watchers
351
- * is redundant.
352
- *
353
- * **Warning**
354
- *
355
- * Suspending scopes from the digest cycle can have unwanted and difficult to debug results.
356
- * Only use this approach if you are confident that you know what you are doing and have
357
- * ample tests to ensure that bindings get updated as you expect.
358
- *
359
- * Some of the things to consider are:
360
- *
361
- * * Any external event on a directive/component will not trigger a digest while the hosting
362
- * scope is suspended - even if the event handler calls `$apply()` or `$rootScope.$digest()`.
363
- * * Transcluded content exists on a scope that inherits from outside a directive but exists
364
- * as a child of the directive's containing scope. If the containing scope is suspended the
365
- * transcluded scope will also be suspended, even if the scope from which the transcluded
366
- * scope inherits is not suspended.
367
- * * Multiple directives trying to manage the suspended status of a scope can confuse each other:
368
- * * A call to `$suspend()` on an already suspended scope is a no-op.
369
- * * A call to `$resume()` on a non-suspended scope is a no-op.
370
- * * If two directives suspend a scope, then one of them resumes the scope, the scope will no
371
- * longer be suspended. This could result in the other directive believing a scope to be
372
- * suspended when it is not.
373
- * * If a parent scope is suspended then all its descendants will be also excluded from future
374
- * digests whether or not they have been suspended themselves. Note that this also applies to
375
- * isolate child scopes.
376
- * * Calling `$digest()` directly on a descendant of a suspended scope will still run the watchers
377
- * for that scope and its descendants. When digesting we only check whether the current scope is
378
- * locally suspended, rather than checking whether it has a suspended ancestor.
379
- * * Calling `$resume()` on a scope that has a suspended ancestor will not cause the scope to be
380
- * included in future digests until all its ancestors have been resumed.
381
- * * Resolved promises, e.g. from explicit `$q` deferreds and `$http` calls, trigger `$apply()`
382
- * against the `$rootScope` and so will still trigger a global digest even if the promise was
383
- * initiated by a component that lives on a suspended scope.
384
- */
385
- $suspend(): void;
386
-
387
- /**
388
- * Call this method to determine if this scope has been explicitly suspended. It will not
389
- * tell you whether an ancestor has been suspended.
390
- * To determine if this scope will be excluded from a digest triggered at the $rootScope,
391
- * for example, you must check all its ancestors:
392
- *
393
- * ```
394
- * function isExcludedFromDigest(scope) {
395
- * while(scope) {
396
- * if (scope.$isSuspended()) return true;
397
- * scope = scope.$parent;
398
- * }
399
- * return false;
400
- * ```
401
- *
402
- * Be aware that a scope may not be included in digests if it has a suspended ancestor,
403
- * even if `$isSuspended()` returns false.
404
- *
405
- * @returns true if the current scope has been suspended.
406
- */
407
- $isSuspended(): boolean;
408
-
409
- /**
410
- * Resume watchers of this scope subtree in case it was suspended.
411
- *
412
- * See {$rootScope.Scope#$suspend} for information about the dangers of using this approach.
413
- */
414
- $resume(): void;
415
-
416
- /**
417
- * Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners.
418
- *
419
- * The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it.
420
- *
421
- * Any exception emitted from the listeners will be passed onto the $exceptionHandler service.
422
- *
423
- * @param name Event name to emit.
424
- * @param args Optional one or more arguments which will be passed onto the event listeners.
425
- */
426
- $emit(name: string, ...args: any[]): IAngularEvent;
427
-
428
- $eval(): any;
429
- $eval(expression: string, locals?: Object): any;
430
- $eval(expression: (scope: Scope) => any, locals?: Object): any;
431
-
432
- $evalAsync(): void;
433
- $evalAsync(expression: string, locals?: Object): void;
434
- $evalAsync(expression: (scope: Scope) => void, locals?: Object): void;
435
-
436
- // Defaults to false by the implementation checking strategy
437
- $new(isolate?: boolean, parent?: Scope): Scope;
438
-
439
- /**
440
- * Listens on events of a given type. See $emit for discussion of event life cycle.
441
- *
442
- * The event listener function format is: function(event, args...).
443
- *
444
- * @param name Event name to listen on.
445
- * @param listener Function to call when the event is emitted.
446
- */
447
- $on(
448
- name: string,
449
- listener: (event: IAngularEvent, ...args: any[]) => any,
450
- ): () => void;
451
-
452
- $watch(
453
- watchExpression: string,
454
- listener?: string,
455
- objectEquality?: boolean,
456
- ): () => void;
457
- $watch<T>(
458
- watchExpression: string,
459
- listener?: (newValue: T, oldValue: T, scope: Scope) => any,
460
- objectEquality?: boolean,
461
- ): () => void;
462
- $watch(
463
- watchExpression: (scope: Scope) => any,
464
- listener?: string,
465
- objectEquality?: boolean,
466
- ): () => void;
467
- $watch<T>(
468
- watchExpression: (scope: Scope) => T,
469
- listener?: (newValue: T, oldValue: T, scope: Scope) => any,
470
- objectEquality?: boolean,
471
- ): () => void;
472
-
473
- $watchCollection<T>(
474
- watchExpression: string,
475
- listener: (newValue: T, oldValue: T, scope: Scope) => any,
476
- ): () => void;
477
- $watchCollection<T>(
478
- watchExpression: (scope: Scope) => T,
479
- listener: (newValue: T, oldValue: T, scope: Scope) => any,
480
- ): () => void;
481
-
482
- $watchGroup(
483
- watchExpressions: any[],
484
- listener: (newValue: any, oldValue: any, scope: Scope) => any,
485
- ): () => void;
486
- $watchGroup(
487
- watchExpressions: Array<{ (scope: Scope): any }>,
488
- listener: (newValue: any, oldValue: any, scope: Scope) => any,
489
- ): () => void;
490
- }
491
-
492
- interface IRootScopeService extends Scope {}
493
-
494
- /**
495
- * $scope for ngRepeat directive.
496
- * see https://docs.angularjs.org/api/ng/directive/ngRepeat
497
- */
498
- interface IRepeatScope extends Scope {
499
- /**
500
- * iterator offset of the repeated element (0..length-1).
501
- */
502
- $index: number;
503
-
504
- /**
505
- * true if the repeated element is first in the iterator.
506
- */
507
- $first: boolean;
508
-
509
- /**
510
- * true if the repeated element is between the first and last in the iterator.
511
- */
512
- $middle: boolean;
513
-
514
- /**
515
- * true if the repeated element is last in the iterator.
516
- */
517
- $last: boolean;
518
-
519
- /**
520
- * true if the iterator position $index is even (otherwise false).
521
- */
522
- $even: boolean;
523
-
524
- /**
525
- * true if the iterator position $index is odd (otherwise false).
526
- */
527
- $odd: boolean;
528
- }
529
-
530
- interface IAngularEvent {
531
- /**
532
- * the scope on which the event was $emit-ed or $broadcast-ed.
533
- */
534
- targetScope: Scope;
535
- /**
536
- * the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null.
537
- */
538
- currentScope: Scope;
539
- /**
540
- * name of the event.
541
- */
542
- name: string;
543
- /**
544
- * calling stopPropagation function will cancel further event propagation (available only for events that were $emit-ed).
545
- */
546
- stopPropagation?(): void;
547
- /**
548
- * calling preventDefault sets defaultPrevented flag to true.
549
- */
550
- preventDefault(): void;
551
- /**
552
- * true if preventDefault was called.
553
- */
554
- defaultPrevented: boolean;
555
- }
556
-
557
- ///////////////////////////////////////////////////////////////////////////
558
- // WindowService
559
- // see http://docs.angularjs.org/api/ng/service/$window
560
- ///////////////////////////////////////////////////////////////////////////
561
- interface IWindowService extends Window {
562
- [key: string]: any;
563
- }
564
-
565
- ///////////////////////////////////////////////////////////////////////////
566
- // TimeoutService
567
- // see http://docs.angularjs.org/api/ng/service/$timeout
568
- ///////////////////////////////////////////////////////////////////////////
569
- interface ITimeoutService {
570
- (delay?: number, invokeApply?: boolean): IPromise<void>;
571
- <T>(
572
- fn: (...args: any[]) => T | IPromise<T>,
573
- delay?: number,
574
- invokeApply?: boolean,
575
- ...args: any[]
576
- ): IPromise<T>;
577
- cancel(promise?: IPromise<any>): boolean;
578
- }
579
-
580
- ///////////////////////////////////////////////////////////////////////////
581
- // IntervalService
582
- // see http://docs.angularjs.org/api/ng/service/$interval
583
- ///////////////////////////////////////////////////////////////////////////
584
- interface IIntervalService {
585
- (
586
- func: Function,
587
- delay: number,
588
- count?: number,
589
- invokeApply?: boolean,
590
- ...args: any[]
591
- ): IPromise<any>;
592
- cancel(promise: IPromise<any>): boolean;
593
- }
594
-
595
- /**
596
- * $filter - $filterProvider - service in module ng
597
- *
598
- * Filters are used for formatting data displayed to the user.
599
- *
600
- * see https://docs.angularjs.org/api/ng/service/$filter
601
- */
602
- interface IFilterService {
603
- (name: "currency"): IFilterCurrency;
604
- (name: "number"): IFilterNumber;
605
- (name: "date"): IFilterDate;
606
- (name: "json"): IFilterJson;
607
- (name: "limitTo"): IFilterLimitTo;
608
- (name: "orderBy"): IFilterOrderBy;
609
- /**
610
- * Usage:
611
- * $filter(name);
612
- *
613
- * @param name Name of the filter function to retrieve
614
- */
615
- <T>(name: string): T;
616
- }
617
-
618
- interface IFilterOrderByItem {
619
- value: any;
620
- type: string;
621
- index: any;
622
- }
623
-
624
- interface IFilterOrderByComparatorFunc {
625
- (left: IFilterOrderByItem, right: IFilterOrderByItem): -1 | 0 | 1;
626
- }
627
-
628
- interface IFilterCurrency {
629
- /**
630
- * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used.
631
- * @param amount Input to filter.
632
- * @param symbol Currency symbol or identifier to be displayed.
633
- * @param fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale
634
- * @return Formatted number
635
- */
636
- (amount: number, symbol?: string, fractionSize?: number): string;
637
- }
638
-
639
- interface IFilterNumber {
640
- /**
641
- * Formats a number as text.
642
- * @param number Number to format.
643
- * @param fractionSize Number of decimal places to round the number to. If this is not provided then the fraction size is computed from the current locale's number formatting pattern. In the case of the default locale, it will be 3.
644
- * @return Number rounded to decimalPlaces and places a “,” after each third digit.
645
- */
646
- (value: number | string, fractionSize?: number | string): string;
647
- }
648
-
649
- interface IFilterDate {
650
- /**
651
- * Formats date to a string based on the requested format.
652
- *
653
- * @param date Date to format either as Date object, milliseconds (string or number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is specified in the string input, the time is considered to be in the local timezone.
654
- * @param format Formatting rules (see Description). If not specified, mediumDate is used.
655
- * @param timezone Timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, '+0430' (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used.
656
- * @return Formatted string or the input if input is not recognized as date/millis.
657
- */
658
- (date: Date | number | string, format?: string, timezone?: string): string;
659
- }
660
-
661
- interface IFilterJson {
662
- /**
663
- * Allows you to convert a JavaScript object into JSON string.
664
- * @param object Any JavaScript object (including arrays and primitive types) to filter.
665
- * @param spacing The number of spaces to use per indentation, defaults to 2.
666
- * @return JSON string.
667
- */
668
- (object: any, spacing?: number): string;
669
- }
670
-
671
- interface IFilterLowercase {
672
- /**
673
- * Converts string to lowercase.
674
- */
675
- (value: string): string;
676
- }
677
-
678
- interface IFilterUppercase {
679
- /**
680
- * Converts string to uppercase.
681
- */
682
- (value: string): string;
683
- }
684
-
685
- interface IFilterLimitTo {
686
- /**
687
- * Creates a new array containing only a specified number of elements. The elements are taken from either the beginning or the end of the source array, string or number, as specified by the value and sign (positive or negative) of limit.
688
- * @param input Source array to be limited.
689
- * @param limit The length of the returned array. If the limit number is positive, limit number of items from the beginning of the source array/string are copied. If the number is negative, limit number of items from the end of the source array are copied. The limit will be trimmed if it exceeds array.length. If limit is undefined, the input will be returned unchanged.
690
- * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0.
691
- * @return A new sub-array of length limit or less if input array had less than limit elements.
692
- */
693
- <T>(input: T[], limit: string | number, begin?: string | number): T[];
694
- /**
695
- * Creates a new string containing only a specified number of elements. The elements are taken from either the beginning or the end of the source string or number, as specified by the value and sign (positive or negative) of limit. If a number is used as input, it is converted to a string.
696
- * @param input Source string or number to be limited.
697
- * @param limit The length of the returned string. If the limit number is positive, limit number of items from the beginning of the source string are copied. If the number is negative, limit number of items from the end of the source string are copied. The limit will be trimmed if it exceeds input.length. If limit is undefined, the input will be returned unchanged.
698
- * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0.
699
- * @return A new substring of length limit or less if input had less than limit elements.
700
- */
701
- (
702
- input: string | number,
703
- limit: string | number,
704
- begin?: string | number,
705
- ): string;
706
- }
707
-
708
- interface IFilterOrderBy {
709
- /**
710
- * Orders a specified array by the expression predicate. It is ordered alphabetically for strings and numerically for numbers. Note: if you notice numbers are not being sorted as expected, make sure they are actually being saved as numbers and not strings.
711
- * @param array The array to sort.
712
- * @param expression A predicate to be used by the comparator to determine the order of elements.
713
- * @param reverse Reverse the order of the array.
714
- * @param comparator Function used to determine the relative order of value pairs.
715
- * @return An array containing the items from the specified collection, ordered by a comparator function based on the values computed using the expression predicate.
716
- */
717
- <T>(
718
- array: T[],
719
- expression:
720
- | string
721
- | ((value: T) => any)
722
- | Array<((value: T) => any) | string>,
723
- reverse?: boolean,
724
- comparator?: IFilterOrderByComparatorFunc,
725
- ): T[];
726
- }
727
-
728
- /**
729
- * $filterProvider - $filter - provider in module ng
730
- *
731
- * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function.
732
- *
733
- * see https://docs.angularjs.org/api/ng/provider/$filterProvider
734
- */
735
- interface IFilterProvider extends IServiceProvider {
736
- /**
737
- * register(name);
738
- *
739
- * @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx).
740
- */
741
- register(name: string | {}): IServiceProvider;
742
- }
743
-
744
- ///////////////////////////////////////////////////////////////////////////
745
- // ParseService
746
- // see http://docs.angularjs.org/api/ng/service/$parse
747
- // see http://docs.angularjs.org/api/ng/provider/$parseProvider
748
- ///////////////////////////////////////////////////////////////////////////
749
- interface IParseService {
750
- (
751
- expression: string | ((scope: Scope) => any),
752
- interceptorFn?: (value: any, scope: Scope, locals: any) => any,
753
- expensiveChecks?: boolean,
754
- ): ICompiledExpression;
755
- }
756
-
757
- interface IParseProvider {
758
- logPromiseWarnings(): boolean;
759
- logPromiseWarnings(value: boolean): IParseProvider;
760
-
761
- unwrapPromises(): boolean;
762
- unwrapPromises(value: boolean): IParseProvider;
763
-
764
- /**
765
- * Configure $parse service to add literal values that will be present as literal at expressions.
766
- *
767
- * @param literalName Token for the literal value. The literal name value must be a valid literal name.
768
- * @param literalValue Value for this literal. All literal values must be primitives or `undefined`.
769
- */
770
- addLiteral(literalName: string, literalValue: any): void;
771
-
772
- /**
773
- * Allows defining the set of characters that are allowed in Angular expressions. The function identifierStart will get called to know if a given character is a valid character to be the first character for an identifier. The function identifierContinue will get called to know if a given character is a valid character to be a follow-up identifier character. The functions identifierStart and identifierContinue will receive as arguments the single character to be identifier and the character code point. These arguments will be string and numeric. Keep in mind that the string parameter can be two characters long depending on the character representation. It is expected for the function to return true or false, whether that character is allowed or not.
774
- * Since this function will be called extensivelly, keep the implementation of these functions fast, as the performance of these functions have a direct impact on the expressions parsing speed.
775
- *
776
- * @param identifierStart The function that will decide whether the given character is a valid identifier start character.
777
- * @param identifierContinue The function that will decide whether the given character is a valid identifier continue character.
778
- */
779
- setIdentifierFns(
780
- identifierStart?: (character: string, codePoint: number) => boolean,
781
- identifierContinue?: (character: string, codePoint: number) => boolean,
782
- ): void;
783
- }
784
-
785
- /**
786
- * $location - $locationProvider - service in module ng
787
- * see https://docs.angularjs.org/api/ng/service/$location
788
- */
789
- interface ILocationService {
790
- absUrl(): string;
791
-
792
- /**
793
- * Returns the hash fragment
794
- */
795
- hash(): string;
796
-
797
- /**
798
- * Changes the hash fragment and returns `$location`
799
- */
800
- hash(newHash: string | null): ILocationService;
801
-
802
- host(): string;
803
-
804
- /**
805
- * Return path of current url
806
- */
807
- path(): string;
808
-
809
- /**
810
- * Change path when called with parameter and return $location.
811
- * Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing.
812
- *
813
- * @param path New path
814
- */
815
- path(path: string): ILocationService;
816
-
817
- port(): number;
818
- protocol(): string;
819
- replace(): ILocationService;
820
-
821
- /**
822
- * Return search part (as object) of current url
823
- */
824
- search(): any;
825
-
826
- /**
827
- * Change search part when called with parameter and return $location.
828
- *
829
- * @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value.
830
- *
831
- * If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url.
832
- */
833
- search(search: any): ILocationService;
834
-
835
- /**
836
- * Change search part when called with parameter and return $location.
837
- *
838
- * @param search New search params
839
- * @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted. If paramValue is an array, it will override the property of the search component of $location specified via the first argument. If paramValue is true, the property specified via the first argument will be added with no value nor trailing equal sign.
840
- */
841
- search(
842
- search: string,
843
- paramValue: string | number | null | string[] | boolean,
844
- ): ILocationService;
845
-
846
- state(): any;
847
- state(state: any): ILocationService;
848
- url(): string;
849
- url(url: string): ILocationService;
850
- }
851
-
852
- interface ILocationProvider extends IServiceProvider {
853
- hashPrefix(): string;
854
- hashPrefix(prefix: string): ILocationProvider;
855
- html5Mode(): boolean;
856
-
857
- // Documentation states that parameter is string, but
858
- // implementation tests it as boolean, which makes more sense
859
- // since this is a toggler
860
- html5Mode(active: boolean): ILocationProvider;
861
- html5Mode(mode: {
862
- enabled?: boolean | undefined;
863
- requireBase?: boolean | undefined;
864
- rewriteLinks?: boolean | undefined;
865
- }): ILocationProvider;
866
- }
867
-
868
- ///////////////////////////////////////////////////////////////////////////
869
- // DocumentService
870
- // see http://docs.angularjs.org/api/ng/service/$document
871
- ///////////////////////////////////////////////////////////////////////////
872
- interface IDocumentService extends JQLite {
873
- // Must return intersection type for index signature compatibility with JQuery
874
- [index: number]: HTMLElement & Document;
875
- }
876
-
877
- ///////////////////////////////////////////////////////////////////////////
878
- // ExceptionHandlerService
879
- // see http://docs.angularjs.org/api/ng/service/$exceptionHandler
880
- ///////////////////////////////////////////////////////////////////////////
881
- interface IExceptionHandlerService {
882
- (exception: Error, cause?: string): void;
883
- }
884
-
885
- ///////////////////////////////////////////////////////////////////////////
886
- // RootElementService
887
- // see http://docs.angularjs.org/api/ng/service/$rootElement
888
- ///////////////////////////////////////////////////////////////////////////
889
- interface IRootElementService extends JQLite {}
890
-
891
- interface IQResolveReject<T> {
892
- (): void;
893
- (value: T): void;
894
- }
895
- /**
896
- * $q - service in module ng
897
- * A promise/deferred implementation inspired by Kris Kowal's Q.
898
- * See http://docs.angularjs.org/api/ng/service/$q
899
- */
900
- interface IQService {
901
- new <T>(
902
- resolver: (
903
- resolve: IQResolveReject<T>,
904
- reject: IQResolveReject<any>,
905
- ) => any,
906
- ): IPromise<T>;
907
- <T>(
908
- resolver: (
909
- resolve: IQResolveReject<T>,
910
- reject: IQResolveReject<any>,
911
- ) => any,
912
- ): IPromise<T>;
913
-
914
- /**
915
- * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
916
- *
917
- * Returns a single promise that will be resolved with an array of values, each value corresponding to the promise at the same index in the promises array. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value.
918
- *
919
- * @param promises An array of promises.
920
- */
921
- all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
922
- values: [
923
- T1 | IPromise<T1>,
924
- T2 | IPromise<T2>,
925
- T3 | IPromise<T3>,
926
- T4 | IPromise<T4>,
927
- T5 | IPromise<T5>,
928
- T6 | IPromise<T6>,
929
- T7 | IPromise<T7>,
930
- T8 | IPromise<T8>,
931
- T9 | IPromise<T9>,
932
- T10 | IPromise<T10>,
933
- ],
934
- ): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
935
- all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
936
- values: [
937
- T1 | IPromise<T1>,
938
- T2 | IPromise<T2>,
939
- T3 | IPromise<T3>,
940
- T4 | IPromise<T4>,
941
- T5 | IPromise<T5>,
942
- T6 | IPromise<T6>,
943
- T7 | IPromise<T7>,
944
- T8 | IPromise<T8>,
945
- T9 | IPromise<T9>,
946
- ],
947
- ): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
948
- all<T1, T2, T3, T4, T5, T6, T7, T8>(
949
- values: [
950
- T1 | IPromise<T1>,
951
- T2 | IPromise<T2>,
952
- T3 | IPromise<T3>,
953
- T4 | IPromise<T4>,
954
- T5 | IPromise<T5>,
955
- T6 | IPromise<T6>,
956
- T7 | IPromise<T7>,
957
- T8 | IPromise<T8>,
958
- ],
959
- ): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
960
- all<T1, T2, T3, T4, T5, T6, T7>(
961
- values: [
962
- T1 | IPromise<T1>,
963
- T2 | IPromise<T2>,
964
- T3 | IPromise<T3>,
965
- T4 | IPromise<T4>,
966
- T5 | IPromise<T5>,
967
- T6 | IPromise<T6>,
968
- T7 | IPromise<T7>,
969
- ],
970
- ): IPromise<[T1, T2, T3, T4, T5, T6, T7]>;
971
- all<T1, T2, T3, T4, T5, T6>(
972
- values: [
973
- T1 | IPromise<T1>,
974
- T2 | IPromise<T2>,
975
- T3 | IPromise<T3>,
976
- T4 | IPromise<T4>,
977
- T5 | IPromise<T5>,
978
- T6 | IPromise<T6>,
979
- ],
980
- ): IPromise<[T1, T2, T3, T4, T5, T6]>;
981
- all<T1, T2, T3, T4, T5>(
982
- values: [
983
- T1 | IPromise<T1>,
984
- T2 | IPromise<T2>,
985
- T3 | IPromise<T3>,
986
- T4 | IPromise<T4>,
987
- T5 | IPromise<T5>,
988
- ],
989
- ): IPromise<[T1, T2, T3, T4, T5]>;
990
- all<T1, T2, T3, T4>(
991
- values: [
992
- T1 | IPromise<T1>,
993
- T2 | IPromise<T2>,
994
- T3 | IPromise<T3>,
995
- T4 | IPromise<T4>,
996
- ],
997
- ): IPromise<[T1, T2, T3, T4]>;
998
- all<T1, T2, T3>(
999
- values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>],
1000
- ): IPromise<[T1, T2, T3]>;
1001
- all<T1, T2>(
1002
- values: [T1 | IPromise<T1>, T2 | IPromise<T2>],
1003
- ): IPromise<[T1, T2]>;
1004
- all<TAll>(promises: Array<TAll | IPromise<TAll>>): IPromise<TAll[]>;
1005
- /**
1006
- * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
1007
- *
1008
- * Returns a single promise that will be resolved with a hash of values, each value corresponding to the promise at the same key in the promises hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value.
1009
- *
1010
- * @param promises A hash of promises.
1011
- */
1012
- all<T>(promises: { [K in keyof T]: IPromise<T[K]> | T[K] }): IPromise<T>;
1013
- /**
1014
- * Creates a Deferred object which represents a task which will finish in the future.
1015
- */
1016
- defer<T>(): IDeferred<T>;
1017
- /**
1018
- * Returns a promise that resolves or rejects as soon as one of those promises resolves or rejects, with the value or reason from that promise.
1019
- *
1020
- * @param promises A list or hash of promises.
1021
- */
1022
- race<T>(
1023
- promises: Array<IPromise<T>> | { [key: string]: IPromise<T> },
1024
- ): IPromise<T>;
1025
- /**
1026
- * Creates a promise that is resolved as rejected with the specified reason. This api should be used to forward rejection in a chain of promises. If you are dealing with the last promise in a promise chain, you don't need to worry about it.
1027
- *
1028
- * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of reject as the throw keyword in JavaScript. This also means that if you "catch" an error via a promise error callback and you want to forward the error to the promise derived from the current promise, you have to "rethrow" the error by returning a rejection constructed via reject.
1029
- *
1030
- * @param reason Constant, message, exception or an object representing the rejection reason.
1031
- */
1032
- reject(reason?: any): IPromise<never>;
1033
- /**
1034
- * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
1035
- *
1036
- * @param value Value or a promise
1037
- */
1038
- resolve<T>(value: PromiseLike<T> | T): IPromise<T>;
1039
- /**
1040
- * @deprecated Since TS 2.4, inference is stricter and no longer produces the desired type when T1 !== T2.
1041
- * To use resolve with two different types, pass a union type to the single-type-argument overload.
1042
- */
1043
- resolve<T1, T2>(value: PromiseLike<T1> | T2): IPromise<T1 | T2>;
1044
- /**
1045
- * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
1046
- */
1047
- resolve(): IPromise<void>;
1048
- /**
1049
- * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
1050
- *
1051
- * @param value Value or a promise
1052
- */
1053
- when<T>(value: PromiseLike<T> | T): IPromise<T>;
1054
- when<T1, T2>(value: PromiseLike<T1> | T2): IPromise<T1 | T2>;
1055
- when<TResult, T>(
1056
- value: PromiseLike<T> | T,
1057
- successCallback: (promiseValue: T) => PromiseLike<TResult> | TResult,
1058
- ): IPromise<TResult>;
1059
- when<TResult, T>(
1060
- value: T,
1061
- successCallback: (promiseValue: T) => PromiseLike<TResult> | TResult,
1062
- errorCallback: null | undefined | ((reason: any) => any),
1063
- notifyCallback?: (state: any) => any,
1064
- ): IPromise<TResult>;
1065
- when<TResult, TResult2, T>(
1066
- value: PromiseLike<T>,
1067
- successCallback: (promiseValue: T) => PromiseLike<TResult> | TResult,
1068
- errorCallback: (reason: any) => TResult2 | PromiseLike<TResult2>,
1069
- notifyCallback?: (state: any) => any,
1070
- ): IPromise<TResult | TResult2>;
1071
- /**
1072
- * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
1073
- */
1074
- when(): IPromise<void>;
1075
- }
1076
-
1077
- interface IQProvider {
1078
- /**
1079
- * Retrieves or overrides whether to generate an error when a rejected promise is not handled.
1080
- * This feature is enabled by default.
1081
- *
1082
- * @returns Current value
1083
- */
1084
- errorOnUnhandledRejections(): boolean;
1085
-
1086
- /**
1087
- * Retrieves or overrides whether to generate an error when a rejected promise is not handled.
1088
- * This feature is enabled by default.
1089
- *
1090
- * @param value Whether to generate an error when a rejected promise is not handled.
1091
- * @returns Self for chaining otherwise.
1092
- */
1093
- errorOnUnhandledRejections(value: boolean): IQProvider;
1094
- }
1095
-
1096
- interface IPromise<T> {
1097
- /**
1098
- * Regardless of when the promise was or will be resolved or rejected, then calls one of
1099
- * the success or error callbacks asynchronously as soon as the result is available. The
1100
- * callbacks are called with a single argument: the result or rejection reason.
1101
- * Additionally, the notify callback may be called zero or more times to provide a
1102
- * progress indication, before the promise is resolved or rejected.
1103
- * The `successCallBack` may return `IPromise<never>` for when a `$q.reject()` needs to
1104
- * be returned.
1105
- * This method returns a new promise which is resolved or rejected via the return value
1106
- * of the `successCallback`, `errorCallback`. It also notifies via the return value of
1107
- * the `notifyCallback` method. The promise can not be resolved or rejected from the
1108
- * `notifyCallback` method.
1109
- */
1110
- then<TResult1 = T, TResult2 = never>(
1111
- successCallback?:
1112
- | ((value: T) => PromiseLike<never> | PromiseLike<TResult1> | TResult1)
1113
- | null,
1114
- errorCallback?:
1115
- | ((
1116
- reason: any,
1117
- ) => PromiseLike<never> | PromiseLike<TResult2> | TResult2)
1118
- | null,
1119
- notifyCallback?: (state: any) => any,
1120
- ): IPromise<TResult1 | TResult2>;
1121
- then<TResult1 = T, TResult2 = never>(
1122
- successCallback?:
1123
- | ((value: T) => IPromise<never> | IPromise<TResult1> | TResult1)
1124
- | null,
1125
- errorCallback?:
1126
- | ((reason: any) => IPromise<never> | IPromise<TResult2> | TResult2)
1127
- | null,
1128
- notifyCallback?: (state: any) => any,
1129
- ): IPromise<TResult1 | TResult2>;
1130
-
1131
- /**
1132
- * Shorthand for promise.then(null, errorCallback)
1133
- */
1134
- catch<TResult = never>(
1135
- onRejected?:
1136
- | ((reason: any) => PromiseLike<never> | PromiseLike<TResult> | TResult)
1137
- | null,
1138
- ): IPromise<T | TResult>;
1139
- catch<TResult = never>(
1140
- onRejected?:
1141
- | ((reason: any) => IPromise<never> | IPromise<TResult> | TResult)
1142
- | null,
1143
- ): IPromise<T | TResult>;
1144
-
1145
- /**
1146
- * Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information.
1147
- *
1148
- * Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible.
1149
- */
1150
- finally(finallyCallback: () => void): IPromise<T>;
1151
- }
1152
-
1153
- interface IDeferred<T> {
1154
- resolve(value?: T | IPromise<T>): void;
1155
- reject(reason?: any): void;
1156
- notify(state?: any): void;
1157
- promise: IPromise<T>;
1158
- }
1159
-
1160
- ///////////////////////////////////////////////////////////////////////////
1161
- // AnchorScrollService
1162
- // see http://docs.angularjs.org/api/ng/service/$anchorScroll
1163
- ///////////////////////////////////////////////////////////////////////////
1164
- interface IAnchorScrollService {
1165
- (): void;
1166
- (hash: string): void;
1167
- yOffset: any;
1168
- }
1169
-
1170
- interface IAnchorScrollProvider extends IServiceProvider {
1171
- disableAutoScrolling(): void;
1172
- }
1173
-
1174
- /**
1175
- * $cacheFactory - service in module ng
1176
- *
1177
- * Factory that constructs Cache objects and gives access to them.
1178
- *
1179
- * see https://docs.angularjs.org/api/ng/service/$cacheFactory
1180
- */
1181
- interface ICacheFactoryService {
1182
- /**
1183
- * Factory that constructs Cache objects and gives access to them.
1184
- *
1185
- * @param cacheId Name or id of the newly created cache.
1186
- * @param optionsMap Options object that specifies the cache behavior. Properties:
1187
- *
1188
- * capacity — turns the cache into LRU cache.
1189
- */
1190
- (
1191
- cacheId: string,
1192
- optionsMap?: { capacity?: number | undefined },
1193
- ): ICacheObject;
1194
-
1195
- /**
1196
- * Get information about all the caches that have been created.
1197
- * @returns key-value map of cacheId to the result of calling cache#info
1198
- */
1199
- info(): any;
1200
-
1201
- /**
1202
- * Get access to a cache object by the cacheId used when it was created.
1203
- *
1204
- * @param cacheId Name or id of a cache to access.
1205
- */
1206
- get(cacheId: string): ICacheObject;
1207
- }
1208
-
1209
- /**
1210
- * $cacheFactory.Cache - type in module ng
1211
- *
1212
- * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data.
1213
- *
1214
- * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache
1215
- */
1216
- interface ICacheObject {
1217
- /**
1218
- * Retrieve information regarding a particular Cache.
1219
- */
1220
- info(): {
1221
- /**
1222
- * the id of the cache instance
1223
- */
1224
- id: string;
1225
-
1226
- /**
1227
- * the number of entries kept in the cache instance
1228
- */
1229
- size: number;
1230
- // ...: any additional properties from the options object when creating the cache.
1231
- };
1232
-
1233
- /**
1234
- * Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set.
1235
- *
1236
- * It will not insert undefined values into the cache.
1237
- *
1238
- * @param key the key under which the cached data is stored.
1239
- * @param value the value to store alongside the key. If it is undefined, the key will not be stored.
1240
- */
1241
- put<T>(key: string, value?: T): T;
1242
-
1243
- /**
1244
- * Retrieves named data stored in the Cache object.
1245
- *
1246
- * @param key the key of the data to be retrieved
1247
- */
1248
- get<T>(key: string): T | undefined;
1249
-
1250
- /**
1251
- * Removes an entry from the Cache object.
1252
- *
1253
- * @param key the key of the entry to be removed
1254
- */
1255
- remove(key: string): void;
1256
-
1257
- /**
1258
- * Clears the cache object of any entries.
1259
- */
1260
- removeAll(): void;
1261
-
1262
- /**
1263
- * Destroys the Cache object entirely, removing it from the $cacheFactory set.
1264
- */
1265
- destroy(): void;
1266
- }
1267
-
1268
- ///////////////////////////////////////////////////////////////////////////
1269
- // CompileService
1270
- // see http://docs.angularjs.org/api/ng/service/$compile
1271
- // see http://docs.angularjs.org/api/ng/provider/$compileProvider
1272
- ///////////////////////////////////////////////////////////////////////////
1273
- interface ICompileService {
1274
- (
1275
- element: string | Element | JQLite,
1276
- transclude?: ITranscludeFunction,
1277
- maxPriority?: number,
1278
- ): ITemplateLinkingFunction;
1279
- }
1280
-
1281
- interface ICompileProvider extends IServiceProvider {
1282
- directive<
1283
- TScope extends Scope = Scope,
1284
- TElement extends JQLite = JQLite,
1285
- TAttributes extends IAttributes = IAttributes,
1286
- TController extends IDirectiveController = IController,
1287
- >(
1288
- name: string,
1289
- directiveFactory: Injectable<
1290
- IDirectiveFactory<TScope, TElement, TAttributes, TController>
1291
- >,
1292
- ): ICompileProvider;
1293
- directive<
1294
- TScope extends Scope = Scope,
1295
- TElement extends JQLite = JQLite,
1296
- TAttributes extends IAttributes = IAttributes,
1297
- TController extends IDirectiveController = IController,
1298
- >(object: {
1299
- [directiveName: string]: Injectable<
1300
- IDirectiveFactory<TScope, TElement, TAttributes, TController>
1301
- >;
1302
- }): ICompileProvider;
1303
-
1304
- component(name: string, options: IComponentOptions): ICompileProvider;
1305
- component(object: {
1306
- [componentName: string]: IComponentOptions;
1307
- }): ICompileProvider;
1308
-
1309
- /** @deprecated The old name of aHrefSanitizationTrustedUrlList. Kept for compatibility. */
1310
- aHrefSanitizationWhitelist(): RegExp;
1311
- /** @deprecated The old name of aHrefSanitizationTrustedUrlList. Kept for compatibility. */
1312
- aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider;
1313
-
1314
- aHrefSanitizationTrustedUrlList(): RegExp;
1315
- aHrefSanitizationTrustedUrlList(regexp: RegExp): ICompileProvider;
1316
-
1317
- /** @deprecated The old name of imgSrcSanitizationTrustedUrlList. Kept for compatibility. */
1318
- imgSrcSanitizationWhitelist(): RegExp;
1319
- /** @deprecated The old name of imgSrcSanitizationTrustedUrlList. Kept for compatibility. */
1320
- imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider;
1321
-
1322
- imgSrcSanitizationTrustedUrlList(): RegExp;
1323
- imgSrcSanitizationTrustedUrlList(regexp: RegExp): ICompileProvider;
1324
-
1325
- debugInfoEnabled(): boolean;
1326
- debugInfoEnabled(enabled: boolean): ICompileProvider;
1327
-
1328
- /**
1329
- * Sets the number of times $onChanges hooks can trigger new changes before giving up and assuming that the model is unstable.
1330
- * Increasing the TTL could have performance implications, so you should not change it without proper justification.
1331
- * Default: 10.
1332
- * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#onChangesTtl
1333
- */
1334
- onChangesTtl(): number;
1335
- onChangesTtl(limit: number): ICompileProvider;
1336
-
1337
- /**
1338
- * It indicates to the compiler whether or not directives on comments should be compiled.
1339
- * It results in a compilation performance gain since the compiler doesn't have to check comments when looking for directives.
1340
- * Defaults to true.
1341
- * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#commentDirectivesEnabled
1342
- */
1343
- commentDirectivesEnabled(): boolean;
1344
- commentDirectivesEnabled(enabled: boolean): ICompileProvider;
1345
-
1346
- /**
1347
- * It indicates to the compiler whether or not directives on element classes should be compiled.
1348
- * It results in a compilation performance gain since the compiler doesn't have to check element classes when looking for directives.
1349
- * Defaults to true.
1350
- * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#cssClassDirectivesEnabled
1351
- */
1352
- cssClassDirectivesEnabled(): boolean;
1353
- cssClassDirectivesEnabled(enabled: boolean): ICompileProvider;
1354
-
1355
- /**
1356
- * Call this method to enable/disable strict component bindings check.
1357
- * If enabled, the compiler will enforce that for all bindings of a
1358
- * component that are not set as optional with ?, an attribute needs
1359
- * to be provided on the component's HTML tag.
1360
- * Defaults to false.
1361
- * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#strictComponentBindingsEnabled
1362
- */
1363
- strictComponentBindingsEnabled(): boolean;
1364
- strictComponentBindingsEnabled(enabled: boolean): ICompileProvider;
1365
- }
1366
-
1367
- interface ICloneAttachFunction {
1368
- // Let's hint but not force cloneAttachFn's signature
1369
- (clonedElement?: JQLite, scope?: Scope): any;
1370
- }
1371
-
1372
- // This corresponds to the "publicLinkFn" returned by $compile.
1373
- interface ITemplateLinkingFunction {
1374
- (
1375
- scope: Scope,
1376
- cloneAttachFn?: ICloneAttachFunction,
1377
- options?: ITemplateLinkingFunctionOptions,
1378
- ): JQLite;
1379
- }
1380
-
1381
- interface ITemplateLinkingFunctionOptions {
1382
- parentBoundTranscludeFn?: ITranscludeFunction | undefined;
1383
- transcludeControllers?:
1384
- | {
1385
- [controller: string]: { instance: IController };
1386
- }
1387
- | undefined;
1388
- futureParentElement?: JQLite | undefined;
1389
- }
1390
-
1391
- /**
1392
- * This corresponds to $transclude passed to controllers and to the transclude function passed to link functions.
1393
- * https://docs.angularjs.org/api/ng/service/$compile#-controller-
1394
- * http://teropa.info/blog/2015/06/09/transclusion.html
1395
- */
1396
- interface ITranscludeFunction {
1397
- // If the scope is provided, then the cloneAttachFn must be as well.
1398
- (
1399
- scope: Scope,
1400
- cloneAttachFn: ICloneAttachFunction,
1401
- futureParentElement?: JQLite,
1402
- slotName?: string,
1403
- ): JQLite;
1404
- // If one argument is provided, then it's assumed to be the cloneAttachFn.
1405
- (
1406
- cloneAttachFn?: ICloneAttachFunction,
1407
- futureParentElement?: JQLite,
1408
- slotName?: string,
1409
- ): JQLite;
1410
-
1411
- /**
1412
- * Returns true if the specified slot contains content (i.e. one or more DOM nodes)
1413
- */
1414
- isSlotFilled(slotName: string): boolean;
1415
- }
1416
-
1417
- ///////////////////////////////////////////////////////////////////////////
1418
- // ControllerService
1419
- // see http://docs.angularjs.org/api/ng/service/$controller
1420
- // see http://docs.angularjs.org/api/ng/provider/$controllerProvider
1421
- ///////////////////////////////////////////////////////////////////////////
1422
-
1423
- /**
1424
- * The minimal local definitions required by $controller(ctrl, locals) calls.
1425
- */
1426
- interface IControllerLocals {
1427
- $scope: ng.Scope;
1428
- $element: JQLite;
1429
- }
1430
-
1431
- interface IControllerService {
1432
- // Although the documentation doesn't state this, locals are optional
1433
- <T>(controllerConstructor: new (...args: any[]) => T, locals?: any): T;
1434
- <T>(controllerConstructor: (...args: any[]) => T, locals?: any): T;
1435
- <T>(controllerName: string, locals?: any): T;
1436
- }
1437
-
1438
- interface IControllerProvider extends IServiceProvider {
1439
- register(name: string, controllerConstructor: Function): void;
1440
- register(name: string, dependencyAnnotatedConstructor: any[]): void;
1441
- }
1442
-
1443
- /**
1444
- * xhrFactory
1445
- * Replace or decorate this service to create your own custom XMLHttpRequest objects.
1446
- * see https://docs.angularjs.org/api/ng/service/$xhrFactory
1447
- */
1448
- interface IXhrFactory<T> {
1449
- (method: string, url: string): T;
1450
- }
1451
-
1452
- /**
1453
- * HttpService
1454
- * see http://docs.angularjs.org/api/ng/service/$http
1455
- */
1456
- interface IHttpService {
1457
- /**
1458
- * Object describing the request to be made and how it should be processed.
1459
- */
1460
- <T>(config: IRequestConfig): IHttpPromise<T>;
1461
-
1462
- /**
1463
- * Shortcut method to perform GET request.
1464
- *
1465
- * @param url Relative or absolute URL specifying the destination of the request
1466
- * @param config Optional configuration object
1467
- */
1468
- get<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
1469
-
1470
- /**
1471
- * Shortcut method to perform DELETE request.
1472
- *
1473
- * @param url Relative or absolute URL specifying the destination of the request
1474
- * @param config Optional configuration object
1475
- */
1476
- delete<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
1477
-
1478
- /**
1479
- * Shortcut method to perform HEAD request.
1480
- *
1481
- * @param url Relative or absolute URL specifying the destination of the request
1482
- * @param config Optional configuration object
1483
- */
1484
- head<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
1485
-
1486
- /**
1487
- * Shortcut method to perform JSONP request.
1488
- *
1489
- * @param url Relative or absolute URL specifying the destination of the request
1490
- * @param config Optional configuration object
1491
- */
1492
- jsonp<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
1493
-
1494
- /**
1495
- * Shortcut method to perform POST request.
1496
- *
1497
- * @param url Relative or absolute URL specifying the destination of the request
1498
- * @param data Request content
1499
- * @param config Optional configuration object
1500
- */
1501
- post<T>(
1502
- url: string,
1503
- data: any,
1504
- config?: IRequestShortcutConfig,
1505
- ): IHttpPromise<T>;
1506
-
1507
- /**
1508
- * Shortcut method to perform PUT request.
1509
- *
1510
- * @param url Relative or absolute URL specifying the destination of the request
1511
- * @param data Request content
1512
- * @param config Optional configuration object
1513
- */
1514
- put<T>(
1515
- url: string,
1516
- data: any,
1517
- config?: IRequestShortcutConfig,
1518
- ): IHttpPromise<T>;
1519
-
1520
- /**
1521
- * Shortcut method to perform PATCH request.
1522
- *
1523
- * @param url Relative or absolute URL specifying the destination of the request
1524
- * @param data Request content
1525
- * @param config Optional configuration object
1526
- */
1527
- patch<T>(
1528
- url: string,
1529
- data: any,
1530
- config?: IRequestShortcutConfig,
1531
- ): IHttpPromise<T>;
1532
-
1533
- /**
1534
- * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations.
1535
- */
1536
- defaults: IHttpProviderDefaults;
1537
-
1538
- /**
1539
- * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes.
1540
- */
1541
- pendingRequests: IRequestConfig[];
1542
- }
1543
-
1544
- /**
1545
- * Object describing the request to be made and how it should be processed.
1546
- * see http://docs.angularjs.org/api/ng/service/$http#usage
1547
- */
1548
- interface IRequestShortcutConfig extends IHttpProviderDefaults {
1549
- /**
1550
- * {Object.<string|Object>}
1551
- * Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified.
1552
- */
1553
- params?: any;
1554
-
1555
- /**
1556
- * {string|Object}
1557
- * Data to be sent as the request message data.
1558
- */
1559
- data?: any;
1560
-
1561
- /**
1562
- * Timeout in milliseconds, or promise that should abort the request when resolved.
1563
- */
1564
- timeout?: number | IPromise<any> | undefined;
1565
-
1566
- /**
1567
- * See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype
1568
- */
1569
- responseType?: string | undefined;
1570
-
1571
- /**
1572
- * Name of the parameter added (by AngularJS) to the request to specify the name (in the server response) of the JSON-P callback to invoke.
1573
- * If unspecified, $http.defaults.jsonpCallbackParam will be used by default. This property is only applicable to JSON-P requests.
1574
- */
1575
- jsonpCallbackParam?: string | undefined;
1576
- }
1577
-
1578
- /**
1579
- * Object describing the request to be made and how it should be processed.
1580
- * see http://docs.angularjs.org/api/ng/service/$http#usage
1581
- */
1582
- interface IRequestConfig extends IRequestShortcutConfig {
1583
- /**
1584
- * HTTP method (e.g. 'GET', 'POST', etc)
1585
- */
1586
- method: string;
1587
- /**
1588
- * Absolute or relative URL of the resource that is being requested.
1589
- */
1590
- url: string;
1591
- /**
1592
- * Event listeners to be bound to the XMLHttpRequest object.
1593
- * To bind events to the XMLHttpRequest upload object, use uploadEventHandlers. The handler will be called in the context of a $apply block.
1594
- */
1595
- eventHandlers?:
1596
- | { [type: string]: EventListenerOrEventListenerObject }
1597
- | undefined;
1598
- /**
1599
- * Event listeners to be bound to the XMLHttpRequest upload object.
1600
- * To bind events to the XMLHttpRequest object, use eventHandlers. The handler will be called in the context of a $apply block.
1601
- */
1602
- uploadEventHandlers?:
1603
- | { [type: string]: EventListenerOrEventListenerObject }
1604
- | undefined;
1605
- }
1606
-
1607
- interface IHttpHeadersGetter {
1608
- (): { [name: string]: string };
1609
- (headerName: string): string;
1610
- }
1611
-
1612
- interface IHttpPromiseCallback<T> {
1613
- (
1614
- data: T,
1615
- status: number,
1616
- headers: IHttpHeadersGetter,
1617
- config: IRequestConfig,
1618
- ): void;
1619
- }
1620
-
1621
- interface IHttpResponse<T> {
1622
- data: T;
1623
- status: number;
1624
- headers: IHttpHeadersGetter;
1625
- config: IRequestConfig;
1626
- statusText: string;
1627
- /** Added in AngularJS 1.6.6 */
1628
- xhrStatus: "complete" | "error" | "timeout" | "abort";
1629
- }
1630
-
1631
- /** @deprecated The old name of IHttpResponse. Kept for compatibility. */
1632
- type IHttpPromiseCallbackArg<T> = IHttpResponse<T>;
1633
-
1634
- type IHttpPromise<T> = IPromise<IHttpResponse<T>>;
1635
-
1636
- // See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
1637
- interface IHttpRequestTransformer {
1638
- (data: any, headersGetter: IHttpHeadersGetter): any;
1639
- }
1640
-
1641
- // The definition of fields are the same as IHttpResponse
1642
- interface IHttpResponseTransformer {
1643
- (data: any, headersGetter: IHttpHeadersGetter, status: number): any;
1644
- }
1645
-
1646
- interface HttpHeaderType {
1647
- [requestType: string]: string | ((config: IRequestConfig) => string);
1648
- }
1649
-
1650
- interface IHttpRequestConfigHeaders {
1651
- [requestType: string]: any;
1652
- common?: any;
1653
- get?: any;
1654
- post?: any;
1655
- put?: any;
1656
- patch?: any;
1657
- }
1658
-
1659
- /**
1660
- * Object that controls the defaults for $http provider. Not all fields of IRequestShortcutConfig can be configured
1661
- * via defaults and the docs do not say which. The following is based on the inspection of the source code.
1662
- * https://docs.angularjs.org/api/ng/service/$http#defaults
1663
- * https://docs.angularjs.org/api/ng/service/$http#usage
1664
- * https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section
1665
- */
1666
- interface IHttpProviderDefaults {
1667
- /**
1668
- * {boolean|Cache}
1669
- * If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching.
1670
- */
1671
- cache?: any;
1672
-
1673
- /**
1674
- * Transform function or an array of such functions. The transform function takes the http request body and
1675
- * headers and returns its transformed (typically serialized) version.
1676
- * @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses}
1677
- */
1678
- transformRequest?:
1679
- | IHttpRequestTransformer
1680
- | IHttpRequestTransformer[]
1681
- | undefined;
1682
-
1683
- /**
1684
- * Transform function or an array of such functions. The transform function takes the http response body and
1685
- * headers and returns its transformed (typically deserialized) version.
1686
- */
1687
- transformResponse?:
1688
- | IHttpResponseTransformer
1689
- | IHttpResponseTransformer[]
1690
- | undefined;
1691
-
1692
- /**
1693
- * Map of strings or functions which return strings representing HTTP headers to send to the server. If the
1694
- * return value of a function is null, the header will not be sent.
1695
- * The key of the map is the request verb in lower case. The "common" key applies to all requests.
1696
- * @see {@link https://docs.angularjs.org/api/ng/service/$http#setting-http-headers}
1697
- */
1698
- headers?: IHttpRequestConfigHeaders | undefined;
1699
-
1700
- /** Name of HTTP header to populate with the XSRF token. */
1701
- xsrfHeaderName?: string | undefined;
1702
-
1703
- /** Name of cookie containing the XSRF token. */
1704
- xsrfCookieName?: string | undefined;
1705
-
1706
- /**
1707
- * whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information.
1708
- */
1709
- withCredentials?: boolean | undefined;
1710
-
1711
- /**
1712
- * A function used to the prepare string representation of request parameters (specified as an object). If
1713
- * specified as string, it is interpreted as a function registered with the $injector. Defaults to
1714
- * $httpParamSerializer.
1715
- */
1716
- paramSerializer?: string | ((obj: any) => string) | undefined;
1717
- }
1718
-
1719
- interface IHttpInterceptor {
1720
- request?(config: IRequestConfig): IRequestConfig | IPromise<IRequestConfig>;
1721
- requestError?(rejection: any): IRequestConfig | IPromise<IRequestConfig>;
1722
- response?<T>(
1723
- response: IHttpResponse<T>,
1724
- ): IPromise<IHttpResponse<T>> | IHttpResponse<T>;
1725
- responseError?<T>(
1726
- rejection: any,
1727
- ): IPromise<IHttpResponse<T>> | IHttpResponse<T>;
1728
- }
1729
-
1730
- interface IHttpInterceptorFactory {
1731
- (...args: any[]): IHttpInterceptor;
1732
- }
1733
-
1734
- interface IHttpProvider extends IServiceProvider {
1735
- defaults: IHttpProviderDefaults;
1736
-
1737
- /**
1738
- * Register service factories (names or implementations) for interceptors which are called before and after
1739
- * each request.
1740
- */
1741
- interceptors: Array<string | Injectable<IHttpInterceptorFactory>>;
1742
- useApplyAsync(): boolean;
1743
- useApplyAsync(value: boolean): IHttpProvider;
1744
-
1745
- /** @deprecated The old name of xsrfTrustedOrigins. Kept for compatibility. */
1746
- xsrfWhitelistedOrigins: string[];
1747
- /**
1748
- * Array containing URLs whose origins are trusted to receive the XSRF token.
1749
- */
1750
- xsrfTrustedOrigins: string[];
1751
- }
1752
-
1753
- ///////////////////////////////////////////////////////////////////////////
1754
- // HttpBackendService
1755
- // see http://docs.angularjs.org/api/ng/service/$httpBackend
1756
- // You should never need to use this service directly.
1757
- ///////////////////////////////////////////////////////////////////////////
1758
- interface IHttpBackendService {
1759
- // XXX Perhaps define callback signature in the future
1760
- (
1761
- method: string,
1762
- url: string,
1763
- post?: any,
1764
- callback?: Function,
1765
- headers?: any,
1766
- timeout?: number,
1767
- withCredentials?: boolean,
1768
- ): void;
1769
- }
1770
-
1771
- ///////////////////////////////////////////////////////////////////////////
1772
- // InterpolateService
1773
- // see http://docs.angularjs.org/api/ng/service/$interpolate
1774
- // see http://docs.angularjs.org/api/ng/provider/$interpolateProvider
1775
- ///////////////////////////////////////////////////////////////////////////
1776
- interface IInterpolateService {
1777
- (
1778
- text: string,
1779
- mustHaveExpression?: boolean,
1780
- trustedContext?: string,
1781
- allOrNothing?: boolean,
1782
- ): IInterpolationFunction;
1783
- endSymbol(): string;
1784
- startSymbol(): string;
1785
- }
1786
-
1787
- interface IInterpolationFunction {
1788
- (context: any): string;
1789
- }
1790
-
1791
- interface IInterpolateProvider extends IServiceProvider {
1792
- startSymbol(): string;
1793
- startSymbol(value: string): IInterpolateProvider;
1794
- endSymbol(): string;
1795
- endSymbol(value: string): IInterpolateProvider;
1796
- }
1797
-
1798
- ///////////////////////////////////////////////////////////////////////////
1799
- // TemplateCacheService
1800
- // see http://docs.angularjs.org/api/ng/service/$templateCache
1801
- ///////////////////////////////////////////////////////////////////////////
1802
- interface ITemplateCacheService extends ICacheObject {}
1803
-
1804
- ///////////////////////////////////////////////////////////////////////////
1805
- // SCEService
1806
- // see http://docs.angularjs.org/api/ng/service/$sce
1807
- ///////////////////////////////////////////////////////////////////////////
1808
- interface ISCEService {
1809
- getTrusted(type: string, mayBeTrusted: any): any;
1810
- getTrustedCss(value: any): any;
1811
- getTrustedHtml(value: any): any;
1812
- getTrustedJs(value: any): any;
1813
- getTrustedResourceUrl(value: any): any;
1814
- getTrustedUrl(value: any): any;
1815
- parse(type: string, expression: string): (context: any, locals: any) => any;
1816
- parseAsCss(expression: string): (context: any, locals: any) => any;
1817
- parseAsHtml(expression: string): (context: any, locals: any) => any;
1818
- parseAsJs(expression: string): (context: any, locals: any) => any;
1819
- parseAsResourceUrl(expression: string): (context: any, locals: any) => any;
1820
- parseAsUrl(expression: string): (context: any, locals: any) => any;
1821
- trustAs(type: string, value: any): any;
1822
- trustAsHtml(value: any): any;
1823
- trustAsJs(value: any): any;
1824
- trustAsResourceUrl(value: any): any;
1825
- trustAsUrl(value: any): any;
1826
- isEnabled(): boolean;
1827
- }
1828
-
1829
- ///////////////////////////////////////////////////////////////////////////
1830
- // SCEProvider
1831
- // see http://docs.angularjs.org/api/ng/provider/$sceProvider
1832
- ///////////////////////////////////////////////////////////////////////////
1833
- interface ISCEProvider extends IServiceProvider {
1834
- enabled(value: boolean): void;
1835
- }
1836
-
1837
- ///////////////////////////////////////////////////////////////////////////
1838
- // SCEDelegateService
1839
- // see http://docs.angularjs.org/api/ng/service/$sceDelegate
1840
- ///////////////////////////////////////////////////////////////////////////
1841
- interface ISCEDelegateService {
1842
- getTrusted(type: string, mayBeTrusted: any): any;
1843
- trustAs(type: string, value: any): any;
1844
- valueOf(value: any): any;
1845
- }
1846
-
1847
- ///////////////////////////////////////////////////////////////////////////
1848
- // SCEDelegateProvider
1849
- // see http://docs.angularjs.org/api/ng/provider/$sceDelegateProvider
1850
- ///////////////////////////////////////////////////////////////////////////
1851
- interface ISCEDelegateProvider extends IServiceProvider {
1852
- /** @deprecated since 1.8.1 */
1853
- resourceUrlBlacklist(): any[];
1854
- /** @deprecated since 1.8.1 */
1855
- resourceUrlBlacklist(bannedList: any[]): void;
1856
- bannedResourceUrlList(): any[];
1857
- bannedResourceUrlList(bannedList: any[]): void;
1858
- /** @deprecated since 1.8.1 */
1859
- resourceUrlWhitelist(): any[];
1860
- /** @deprecated since 1.8.1 */
1861
- resourceUrlWhitelist(trustedList: any[]): void;
1862
- trustedResourceUrlList(): any[];
1863
- trustedResourceUrlList(trustedList: any[]): void;
1864
- }
1865
-
1866
- /**
1867
- * $templateRequest service
1868
- * see http://docs.angularjs.org/api/ng/service/$templateRequest
1869
- */
1870
- interface ITemplateRequestService {
1871
- /**
1872
- * Downloads a template using $http and, upon success, stores the
1873
- * contents inside of $templateCache.
1874
- *
1875
- * If the HTTP request fails or the response data of the HTTP request is
1876
- * empty then a $compile error will be thrown (unless
1877
- * {ignoreRequestError} is set to true).
1878
- *
1879
- * @param tpl The template URL.
1880
- * @param ignoreRequestError Whether or not to ignore the exception
1881
- * when the request fails or the template is
1882
- * empty.
1883
- *
1884
- * @return A promise whose value is the template content.
1885
- */
1886
- (tpl: string, ignoreRequestError?: boolean): IPromise<string>;
1887
- /**
1888
- * total amount of pending template requests being downloaded.
1889
- */
1890
- totalPendingRequests: number;
1891
- }
1892
-
1893
- ///////////////////////////////////////////////////////////////////////////
1894
- // Component
1895
- // see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html
1896
- // and http://toddmotto.com/exploring-the-angular-1-5-component-method/
1897
- ///////////////////////////////////////////////////////////////////////////
1898
- /**
1899
- * Component definition object (a simplified directive definition object)
1900
- */
1901
- interface IComponentOptions {
1902
- /**
1903
- * Controller constructor function that should be associated with newly created scope or the name of a registered
1904
- * controller if passed as a string. Empty function by default.
1905
- * Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection)
1906
- */
1907
- controller?: string | Injectable<IControllerConstructor> | undefined;
1908
- /**
1909
- * An identifier name for a reference to the controller. If present, the controller will be published to its scope under
1910
- * the specified name. If not present, this will default to '$ctrl'.
1911
- */
1912
- controllerAs?: string | undefined;
1913
- /**
1914
- * html template as a string or a function that returns an html template as a string which should be used as the
1915
- * contents of this component. Empty string by default.
1916
- * If template is a function, then it is injected with the following locals:
1917
- * $element - Current element
1918
- * $attrs - Current attributes object for the element
1919
- * Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection)
1920
- */
1921
- template?: string | Injectable<(...args: any[]) => string> | undefined;
1922
- /**
1923
- * Path or function that returns a path to an html template that should be used as the contents of this component.
1924
- * If templateUrl is a function, then it is injected with the following locals:
1925
- * $element - Current element
1926
- * $attrs - Current attributes object for the element
1927
- * Use the array form to define dependencies (necessary if strictDi is enabled and you require dependency injection)
1928
- */
1929
- templateUrl?: string | Injectable<(...args: any[]) => string> | undefined;
1930
- /**
1931
- * Define DOM attribute binding to component properties. Component properties are always bound to the component
1932
- * controller and not to the scope.
1933
- */
1934
- bindings?: { [boundProperty: string]: string } | undefined;
1935
- /**
1936
- * Whether transclusion is enabled. Disabled by default.
1937
- */
1938
- transclude?: boolean | { [slot: string]: string } | undefined;
1939
- /**
1940
- * Requires the controllers of other directives and binds them to this component's controller.
1941
- * The object keys specify the property names under which the required controllers (object values) will be bound.
1942
- * Note that the required controllers will not be available during the instantiation of the controller,
1943
- * but they are guaranteed to be available just before the $onInit method is executed!
1944
- */
1945
- require?: { [controller: string]: string } | undefined;
1946
- }
1947
-
1948
- /**
1949
- * Interface for the $onInit lifecycle hook
1950
- * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
1951
- */
1952
- interface IOnInit {
1953
- /**
1954
- * Called on each controller after all the controllers on an element have been constructed and had their bindings
1955
- * initialized (and before the pre & post linking functions for the directives on this element). This is a good
1956
- * place to put initialization code for your controller.
1957
- */
1958
- $onInit(): void;
1959
- }
1960
-
1961
- /**
1962
- * Interface for the $doCheck lifecycle hook
1963
- * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
1964
- */
1965
- interface IDoCheck {
1966
- /**
1967
- * Called on each turn of the digest cycle. Provides an opportunity to detect and act on changes.
1968
- * Any actions that you wish to take in response to the changes that you detect must be invoked from this hook;
1969
- * implementing this has no effect on when `$onChanges` is called. For example, this hook could be useful if you wish
1970
- * to perform a deep equality check, or to check a `Dat`e object, changes to which would not be detected by Angular's
1971
- * change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; if detecting changes,
1972
- * you must store the previous value(s) for comparison to the current values.
1973
- */
1974
- $doCheck(): void;
1975
- }
1976
-
1977
- /**
1978
- * Interface for the $onChanges lifecycle hook
1979
- * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
1980
- */
1981
- interface IOnChanges {
1982
- /**
1983
- * Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound
1984
- * properties that have changed, and the values are an {@link IChangesObject} object of the form
1985
- * { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as
1986
- * cloning the bound value to prevent accidental mutation of the outer value.
1987
- */
1988
- $onChanges(onChangesObj: IOnChangesObject): void;
1989
- }
1990
-
1991
- /**
1992
- * Interface for the $onDestroy lifecycle hook
1993
- * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
1994
- */
1995
- interface IOnDestroy {
1996
- /**
1997
- * Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources,
1998
- * watches and event handlers.
1999
- */
2000
- $onDestroy(): void;
2001
- }
2002
-
2003
- /**
2004
- * Interface for the $postLink lifecycle hook
2005
- * https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
2006
- */
2007
- interface IPostLink {
2008
- /**
2009
- * Called after this controller's element and its children have been linked. Similar to the post-link function this
2010
- * hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain
2011
- * templateUrl directives will not have been compiled and linked since they are waiting for their template to load
2012
- * asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered
2013
- * analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather
2014
- * different in Angular 1 there is no direct mapping and care should be taken when upgrading.
2015
- */
2016
- $postLink(): void;
2017
- }
2018
-
2019
- ///////////////////////////////////////////////////////////////////////////
2020
- // Directive
2021
- // see http://docs.angularjs.org/api/ng/provider/$compileProvider#directive
2022
- // and http://docs.angularjs.org/guide/directive
2023
- ///////////////////////////////////////////////////////////////////////////
2024
-
2025
-
2026
- interface IDirectiveFactory<
2027
- TScope extends Scope = Scope,
2028
- TElement extends JQLite = JQLite,
2029
- TAttributes extends IAttributes = IAttributes,
2030
- TController extends IDirectiveController = IController,
2031
- > {
2032
- (
2033
- ...args: any[]
2034
- ):
2035
- | IDirective<TScope, TElement, TAttributes, TController>
2036
- | IDirectiveLinkFn<TScope, TElement, TAttributes, TController>;
2037
- }
2038
-
2039
-
2040
-
2041
-
2042
-
2043
- /**
2044
- * These interfaces are kept for compatibility with older versions of these type definitions.
2045
- * Actually, Angular doesn't create a special subclass of jQuery objects. It extends jQuery.prototype
2046
- * like jQuery plugins do, that's why all jQuery objects have these Angular-specific methods, not
2047
- * only those returned from angular.element.
2048
- * See: http://docs.angularjs.org/api/angular.element
2049
- */
2050
- interface IAugmentedJQueryStatic extends JQueryStatic {}
2051
- interface IAugmentedJQuery extends JQLite {}
2052
-
2053
- /**
2054
- * Same as IController. Keeping it for compatibility with older versions of these type definitions.
2055
- */
2056
- interface IComponentController extends IController {}
2057
-
2058
- ///////////////////////////////////////////////////////////////////////////
2059
- // AUTO module (angular.js)
2060
- ///////////////////////////////////////////////////////////////////////////
2061
- namespace auto {
2062
-
2063
- ///////////////////////////////////////////////////////////////////////
2064
- // ProvideService
2065
- // see http://docs.angularjs.org/api/AUTO.$provide
2066
- ///////////////////////////////////////////////////////////////////////
2067
- interface IProvideService {
2068
- // Documentation says it returns the registered instance, but actual
2069
- // implementation does not return anything.
2070
- // constant(name: string, value: any): any;
2071
- /**
2072
- * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator.
2073
- *
2074
- * @param name The name of the constant.
2075
- * @param value The constant value.
2076
- */
2077
- constant(name: string, value: any): void;
2078
-
2079
- /**
2080
- * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service.
2081
- *
2082
- * @param name The name of the service to decorate.
2083
- * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments:
2084
- *
2085
- * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
2086
- */
2087
- decorator(name: string, decorator: Function): void;
2088
- /**
2089
- * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service.
2090
- *
2091
- * @param name The name of the service to decorate.
2092
- * @param inlineAnnotatedFunction This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments:
2093
- *
2094
- * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
2095
- */
2096
- decorator(name: string, inlineAnnotatedFunction: any[]): void;
2097
- factory(name: string, serviceFactoryFunction: Function): IServiceProvider;
2098
- factory(name: string, inlineAnnotatedFunction: any[]): IServiceProvider;
2099
- provider(name: string, provider: IServiceProvider): IServiceProvider;
2100
- provider(
2101
- name: string,
2102
- serviceProviderConstructor: Function,
2103
- ): IServiceProvider;
2104
- service(name: string, constructor: Function): IServiceProvider;
2105
- service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider;
2106
- value(name: string, value: any): IServiceProvider;
2107
- }
2108
- }
2109
-
2110
- /**
2111
- * $http params serializer that converts objects to strings
2112
- * see https://docs.angularjs.org/api/ng/service/$httpParamSerializer
2113
- */
2114
- interface IHttpParamSerializer {
2115
- (obj: Object): string;
2116
- }
2117
-
2118
- interface IFilterFunction extends Function {
2119
- /**
2120
- * By default, filters are only run once the input value changes. By marking the filter as `$stateful`, the filter will be run on every `$digest` to update the output. **This is strongly discouraged.**
2121
- * See https://docs.angularjs.org/guide/filter#stateful-filters
2122
- */
2123
- $stateful?: boolean | undefined;
2124
- }
2125
- type FilterFactory = (...I: any[]) => IFilterFunction;
2126
- }