@angular-wave/angular.ts 0.0.21 → 0.0.23

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