UNPKG

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