1 |
|
2 |
|
3 | declare var angular: angular.IAngularStatic;
|
4 |
|
5 |
|
6 | declare global {
|
7 | interface Function {
|
8 | $inject?: readonly string[] | undefined;
|
9 | }
|
10 | }
|
11 |
|
12 | export as namespace angular;
|
13 | export as namespace ng;
|
14 |
|
15 |
|
16 | export = angular;
|
17 |
|
18 | import ng = angular;
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | declare namespace angular {
|
24 | type Injectable<T extends Function> = T | Array<string | T>;
|
25 |
|
26 |
|
27 | interface IServiceProviderClass {
|
28 | new(...args: any[]): IServiceProvider;
|
29 | }
|
30 |
|
31 | interface IServiceProviderFactory {
|
32 | (...args: any[]): IServiceProvider;
|
33 | }
|
34 |
|
35 |
|
36 | interface IServiceProvider {
|
37 | $get: any;
|
38 | }
|
39 |
|
40 | interface IAngularBootstrapConfig {
|
41 | strictDi?: boolean | undefined;
|
42 | }
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | interface IAngularStatic {
|
49 | bind(context: any, fn: Function, ...args: any[]): Function;
|
50 |
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | bootstrap(
|
62 | element: string | Element | JQuery | Document,
|
63 | modules?: Array<string | Function | any[]>,
|
64 | config?: IAngularBootstrapConfig,
|
65 | ): auto.IInjectorService;
|
66 |
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | copy<T>(source: T, destination?: T): T;
|
79 |
|
80 | |
81 |
|
82 |
|
83 |
|
84 |
|
85 | element: JQueryStatic;
|
86 | |
87 |
|
88 |
|
89 |
|
90 | errorHandlingConfig(): IErrorHandlingConfig;
|
91 | errorHandlingConfig(config: IErrorHandlingConfig): void;
|
92 | equals(value1: any, value2: any): boolean;
|
93 | extend(destination: any, ...sources: any[]): any;
|
94 |
|
95 | |
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | forEach<T, U extends ArrayLike<T> = T[]>(
|
105 | obj: U,
|
106 | iterator: (value: U[number], key: number, obj: U) => void,
|
107 | context?: any,
|
108 | ): U;
|
109 | |
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 | forEach<T>(
|
119 | obj: { [index: string]: T },
|
120 | iterator: (value: T, key: string, obj: { [index: string]: T }) => void,
|
121 | context?: any,
|
122 | ): { [index: string]: T };
|
123 | |
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | forEach(obj: any, iterator: (value: any, key: any, obj: any) => void, context?: any): any;
|
133 |
|
134 | fromJson(json: string): any;
|
135 | identity<T>(arg?: T): T;
|
136 | injector(modules?: any[], strictDi?: boolean): auto.IInjectorService;
|
137 | isArray(value: any): value is any[];
|
138 | isDate(value: any): value is Date;
|
139 | isDefined(value: any): boolean;
|
140 | isElement(value: any): boolean;
|
141 | isFunction(value: any): value is Function;
|
142 | isNumber(value: any): value is number;
|
143 | isObject(value: any): value is Object;
|
144 | isObject<T>(value: any): value is T;
|
145 | isString(value: any): value is string;
|
146 | isUndefined(value: any): boolean;
|
147 |
|
148 | |
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | merge(dst: any, ...src: any[]): any;
|
157 |
|
158 | |
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 | module(
|
168 | name: string,
|
169 | requires?: string[],
|
170 | configFn?: Injectable<Function>,
|
171 | ): 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 |
|
186 |
|
187 |
|
188 | resumeBootstrap?(extraModules?: string[]): ng.auto.IInjectorService;
|
189 |
|
190 | |
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 | UNSAFE_restoreLegacyJqLiteXHTMLReplacement(): void;
|
200 | }
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 | interface IModule {
|
207 | |
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 | component(name: string, options: IComponentOptions): IModule;
|
214 | |
215 |
|
216 |
|
217 |
|
218 |
|
219 | component(object: { [componentName: string]: IComponentOptions }): IModule;
|
220 | |
221 |
|
222 |
|
223 |
|
224 |
|
225 | config(configFn: Function): IModule;
|
226 | |
227 |
|
228 |
|
229 |
|
230 |
|
231 | config(inlineAnnotatedFunction: any[]): IModule;
|
232 | config(object: Object): IModule;
|
233 | |
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 | constant<T>(name: string, value: T): IModule;
|
240 | constant(object: Object): IModule;
|
241 | |
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 | controller(name: string, controllerConstructor: Injectable<IControllerConstructor>): IModule;
|
250 | controller(object: { [name: string]: Injectable<IControllerConstructor> }): IModule;
|
251 | |
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 | directive<
|
258 | TScope extends IScope = IScope,
|
259 | TElement extends JQLite = JQLite,
|
260 | TAttributes extends IAttributes = IAttributes,
|
261 | TController extends IDirectiveController = IController,
|
262 | >(
|
263 | name: string,
|
264 | directiveFactory: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>,
|
265 | ): IModule;
|
266 | directive<
|
267 | TScope extends IScope = IScope,
|
268 | TElement extends JQLite = JQLite,
|
269 | TAttributes extends IAttributes = IAttributes,
|
270 | TController extends IDirectiveController = IController,
|
271 | >(
|
272 | object: {
|
273 | [directiveName: string]: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>;
|
274 | },
|
275 | ): IModule;
|
276 |
|
277 | |
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 | factory(name: string, $getFn: Injectable<Function>): IModule;
|
284 | factory(object: { [name: string]: Injectable<Function> }): IModule;
|
285 | filter(name: string, filterFactoryFunction: Injectable<FilterFactory>): IModule;
|
286 | filter(object: { [name: string]: Injectable<FilterFactory> }): IModule;
|
287 | provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule;
|
288 | provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule;
|
289 | provider(name: string, inlineAnnotatedConstructor: any[]): IModule;
|
290 | provider(name: string, providerObject: IServiceProvider): IModule;
|
291 | provider(object: Object): IModule;
|
292 | |
293 |
|
294 |
|
295 | run(initializationFunction: Injectable<Function>): IModule;
|
296 | |
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 | service(name: string, serviceConstructor: Injectable<Function>): IModule;
|
303 | service(object: { [name: string]: Injectable<Function> }): IModule;
|
304 | |
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 | value<T>(name: string, value: T): IModule;
|
313 | value(object: Object): IModule;
|
314 |
|
315 | |
316 |
|
317 |
|
318 |
|
319 |
|
320 | decorator(name: string, decorator: Injectable<Function>): IModule;
|
321 |
|
322 |
|
323 | name: string;
|
324 | requires: string[];
|
325 | }
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 | interface IAttributes {
|
332 | |
333 |
|
334 |
|
335 |
|
336 |
|
337 | [name: string]: any;
|
338 |
|
339 | |
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 | $normalize(name: string): string;
|
347 |
|
348 | |
349 |
|
350 |
|
351 |
|
352 |
|
353 | $addClass(classVal: string): void;
|
354 |
|
355 | |
356 |
|
357 |
|
358 |
|
359 |
|
360 | $removeClass(classVal: string): void;
|
361 |
|
362 | |
363 |
|
364 |
|
365 |
|
366 | $updateClass(newClasses: string, oldClasses: string): void;
|
367 |
|
368 | |
369 |
|
370 |
|
371 | $set(key: string, value: any): void;
|
372 |
|
373 | |
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 | $observe<T>(name: string, fn: (value?: T) => any): Function;
|
380 |
|
381 | /**
|
382 | * A map of DOM element attribute names to the normalized name. This is needed
|
383 | * to do reverse lookup from normalized name back to actual name.
|
384 | */
|
385 | $attr: Object;
|
386 | }
|
387 |
|
388 | /**
|
389 | * form.FormController - type in module ng
|
390 | * see https://docs.angularjs.org/api/ng/type/form.FormController
|
391 | */
|
392 | interface IFormController {
|
393 | /**
|
394 | * 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
|
395 | */
|
396 | [name: string]: any;
|
397 |
|
398 | $pristine: boolean;
|
399 | $dirty: boolean;
|
400 | $valid: boolean;
|
401 | $invalid: boolean;
|
402 | $submitted: boolean;
|
403 | $error: { [validationErrorKey: string]: Array<INgModelController | IFormController> };
|
404 | $name?: string | undefined;
|
405 | $pending?: { [validationErrorKey: string]: Array<INgModelController | IFormController> } | undefined;
|
406 | $addControl(control: INgModelController | IFormController): void;
|
407 | $getControls(): ReadonlyArray<INgModelController | IFormController>;
|
408 | $removeControl(control: INgModelController | IFormController): void;
|
409 | $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController | IFormController): void;
|
410 | $setDirty(): void;
|
411 | $setPristine(): void;
|
412 | $commitViewValue(): void;
|
413 | $rollbackViewValue(): void;
|
414 | $setSubmitted(): void;
|
415 | $setUntouched(): void;
|
416 | }
|
417 |
|
418 | ///////////////////////////////////////////////////////////////////////////
|
419 | // NgModelController
|
420 | // see http://docs.angularjs.org/api/ng/type/ngModel.NgModelController
|
421 | ///////////////////////////////////////////////////////////////////////////
|
422 | interface INgModelController {
|
423 | $render(): void;
|
424 | $setValidity(validationErrorKey: string, isValid: boolean): void;
|
425 | // Documentation states viewValue and modelValue to be a string but other
|
426 | // types do work and it's common to use them.
|
427 | $setViewValue(value: any, trigger?: string): void;
|
428 | $setPristine(): void;
|
429 | $setDirty(): void;
|
430 | $validate(): void;
|
431 | $setTouched(): void;
|
432 | $setUntouched(): void;
|
433 | $rollbackViewValue(): void;
|
434 | $commitViewValue(): void;
|
435 | $processModelValue(): void;
|
436 | $isEmpty(value: any): boolean;
|
437 | $overrideModelOptions(options: INgModelOptions): void;
|
438 |
|
439 | $viewValue: any;
|
440 |
|
441 | $modelValue: any;
|
442 |
|
443 | $parsers: IModelParser[];
|
444 | $formatters: IModelFormatter[];
|
445 | $viewChangeListeners: IModelViewChangeListener[];
|
446 | $error: { [validationErrorKey: string]: boolean };
|
447 | $name?: string | undefined;
|
448 |
|
449 | $touched: boolean;
|
450 | $untouched: boolean;
|
451 |
|
452 | $validators: IModelValidators;
|
453 | $asyncValidators: IAsyncModelValidators;
|
454 |
|
455 | $pending?: { [validationErrorKey: string]: boolean } | undefined;
|
456 | $pristine: boolean;
|
457 | $dirty: boolean;
|
458 | $valid: boolean;
|
459 | $invalid: boolean;
|
460 | }
|
461 |
|
462 | // Allows tuning how model updates are done.
|
463 | // https://docs.angularjs.org/api/ng/directive/ngModelOptions
|
464 | interface INgModelOptions {
|
465 | updateOn?: string | undefined;
|
466 | debounce?: number | { [key: string]: number } | undefined;
|
467 | allowInvalid?: boolean | undefined;
|
468 | getterSetter?: boolean | undefined;
|
469 | timezone?: string | undefined;
|
470 | /**
|
471 | * Defines if the time and datetime-local types should show seconds and milliseconds.
|
472 | * The option follows the format string of date filter.
|
473 | * By default, the options is undefined which is equal to 'ss.sss' (seconds and milliseconds)
|
474 | */
|
475 | timeSecondsFormat?: string | undefined;
|
476 | /**
|
477 | * Defines if the time and datetime-local types should strip the seconds and milliseconds
|
478 | * from the formatted value if they are zero. This option is applied after `timeSecondsFormat`
|
479 | */
|
480 | timeStripZeroSeconds?: boolean | undefined;
|
481 | }
|
482 |
|
483 | interface IModelValidators {
|
484 | /**
|
485 | * viewValue is any because it can be an object that is called in the view like $viewValue.name:$viewValue.subName
|
486 | */
|
487 | [index: string]: (modelValue: any, viewValue: any) => boolean;
|
488 | }
|
489 |
|
490 | interface IAsyncModelValidators {
|
491 | [index: string]: (modelValue: any, viewValue: any) => IPromise<any>;
|
492 | }
|
493 |
|
494 | interface IErrorHandlingConfig {
|
495 | |
496 |
|
497 |
|
498 |
|
499 |
|
500 | objectMaxDepth?: number | undefined;
|
501 | |
502 |
|
503 |
|
504 |
|
505 |
|
506 | urlErrorParamsEnabled?: boolean | undefined;
|
507 | }
|
508 |
|
509 | interface IModelParser {
|
510 | (value: any): any;
|
511 | }
|
512 |
|
513 | interface IModelFormatter {
|
514 | (value: any): any;
|
515 | }
|
516 |
|
517 | interface IModelViewChangeListener {
|
518 | (): void;
|
519 | }
|
520 |
|
521 | |
522 |
|
523 |
|
524 |
|
525 | interface IRootScopeService {
|
526 | $apply(): any;
|
527 | $apply(exp: string): any;
|
528 | $apply(exp: (scope: IScope) => any): any;
|
529 |
|
530 | $applyAsync(): any;
|
531 | $applyAsync(exp: string): any;
|
532 | $applyAsync(exp: (scope: IScope) => any): any;
|
533 |
|
534 | |
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 | $broadcast(name: string, ...args: any[]): IAngularEvent;
|
545 | $destroy(): void;
|
546 | $digest(): void;
|
547 |
|
548 | |
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 |
|
585 |
|
586 | $suspend(): void;
|
587 |
|
588 | |
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 | $isSuspended(): boolean;
|
609 |
|
610 | |
611 |
|
612 |
|
613 |
|
614 |
|
615 | $resume(): void;
|
616 |
|
617 | |
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 | $emit(name: string, ...args: any[]): IAngularEvent;
|
628 |
|
629 | $eval(): any;
|
630 | $eval(expression: string, locals?: Object): any;
|
631 | $eval(expression: (scope: IScope) => any, locals?: Object): any;
|
632 |
|
633 | $evalAsync(): void;
|
634 | $evalAsync(expression: string, locals?: Object): void;
|
635 | $evalAsync(expression: (scope: IScope) => void, locals?: Object): void;
|
636 |
|
637 |
|
638 | $new(isolate?: boolean, parent?: IScope): IScope;
|
639 |
|
640 | |
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 | $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): () => void;
|
649 |
|
650 | $watch(watchExpression: string, listener?: string, objectEquality?: boolean): () => void;
|
651 | $watch<T>(
|
652 | watchExpression: string,
|
653 | listener?: (newValue: T, oldValue: T, scope: IScope) => any,
|
654 | objectEquality?: boolean,
|
655 | ): () => void;
|
656 | $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): () => void;
|
657 | $watch<T>(
|
658 | watchExpression: (scope: IScope) => T,
|
659 | listener?: (newValue: T, oldValue: T, scope: IScope) => any,
|
660 | objectEquality?: boolean,
|
661 | ): () => void;
|
662 |
|
663 | $watchCollection<T>(
|
664 | watchExpression: string,
|
665 | listener: (newValue: T, oldValue: T, scope: IScope) => any,
|
666 | ): () => void;
|
667 | $watchCollection<T>(
|
668 | watchExpression: (scope: IScope) => T,
|
669 | listener: (newValue: T, oldValue: T, scope: IScope) => any,
|
670 | ): () => void;
|
671 |
|
672 | $watchGroup(
|
673 | watchExpressions: any[],
|
674 | listener: (newValue: any, oldValue: any, scope: IScope) => any,
|
675 | ): () => void;
|
676 | $watchGroup(
|
677 | watchExpressions: Array<{ (scope: IScope): any }>,
|
678 | listener: (newValue: any, oldValue: any, scope: IScope) => any,
|
679 | ): () => void;
|
680 |
|
681 | $parent: IScope;
|
682 | $root: IRootScopeService;
|
683 | $id: number;
|
684 |
|
685 |
|
686 | $$isolateBindings: any;
|
687 | $$phase: any;
|
688 | }
|
689 |
|
690 | interface IScope extends IRootScopeService {}
|
691 |
|
692 | |
693 |
|
694 |
|
695 |
|
696 | interface IRepeatScope extends IScope {
|
697 | |
698 |
|
699 |
|
700 | $index: number;
|
701 |
|
702 | |
703 |
|
704 |
|
705 | $first: boolean;
|
706 |
|
707 | |
708 |
|
709 |
|
710 | $middle: boolean;
|
711 |
|
712 | |
713 |
|
714 |
|
715 | $last: boolean;
|
716 |
|
717 | |
718 |
|
719 |
|
720 | $even: boolean;
|
721 |
|
722 | |
723 |
|
724 |
|
725 | $odd: boolean;
|
726 | }
|
727 |
|
728 | interface IAngularEvent {
|
729 | |
730 |
|
731 |
|
732 | targetScope: IScope;
|
733 | |
734 |
|
735 |
|
736 | currentScope: IScope;
|
737 | |
738 |
|
739 |
|
740 | name: string;
|
741 | |
742 |
|
743 |
|
744 | stopPropagation?(): void;
|
745 | |
746 |
|
747 |
|
748 | preventDefault(): void;
|
749 | |
750 |
|
751 |
|
752 | defaultPrevented: boolean;
|
753 | }
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 | interface IWindowService extends Window {
|
760 | [key: string]: any;
|
761 | }
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 | interface ITimeoutService {
|
768 | (delay?: number, invokeApply?: boolean): IPromise<void>;
|
769 | <T>(
|
770 | fn: (...args: any[]) => T | IPromise<T>,
|
771 | delay?: number,
|
772 | invokeApply?: boolean,
|
773 | ...args: any[]
|
774 | ): IPromise<T>;
|
775 | cancel(promise?: IPromise<any>): boolean;
|
776 | }
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 | interface IIntervalService {
|
783 | (func: Function, delay: number, count?: number, invokeApply?: boolean, ...args: any[]): IPromise<any>;
|
784 | cancel(promise: IPromise<any>): boolean;
|
785 | }
|
786 |
|
787 | |
788 |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 | interface IFilterService {
|
795 | (name: "filter"): IFilterFilter;
|
796 | (name: "currency"): IFilterCurrency;
|
797 | (name: "number"): IFilterNumber;
|
798 | (name: "date"): IFilterDate;
|
799 | (name: "json"): IFilterJson;
|
800 | (name: "lowercase"): IFilterLowercase;
|
801 | (name: "uppercase"): IFilterUppercase;
|
802 | (name: "limitTo"): IFilterLimitTo;
|
803 | (name: "orderBy"): IFilterOrderBy;
|
804 | |
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 | <T>(name: string): T;
|
811 | }
|
812 |
|
813 | interface IFilterFilter {
|
814 | <T>(
|
815 | array: T[],
|
816 | expression: string | IFilterFilterPatternObject | IFilterFilterPredicateFunc<T>,
|
817 | comparator?: IFilterFilterComparatorFunc<T> | boolean,
|
818 | ): T[];
|
819 | }
|
820 |
|
821 | interface IFilterFilterPatternObject {
|
822 | [name: string]: any;
|
823 | }
|
824 |
|
825 | interface IFilterFilterPredicateFunc<T> {
|
826 | (value: T, index: number, array: T[]): boolean;
|
827 | }
|
828 |
|
829 | interface IFilterFilterComparatorFunc<T> {
|
830 | (actual: T, expected: T): boolean;
|
831 | }
|
832 |
|
833 | interface IFilterOrderByItem {
|
834 | value: any;
|
835 | type: string;
|
836 | index: any;
|
837 | }
|
838 |
|
839 | interface IFilterOrderByComparatorFunc {
|
840 | (left: IFilterOrderByItem, right: IFilterOrderByItem): -1 | 0 | 1;
|
841 | }
|
842 |
|
843 | interface IFilterCurrency {
|
844 | |
845 |
|
846 |
|
847 |
|
848 |
|
849 |
|
850 |
|
851 | (amount: number, symbol?: string, fractionSize?: number): string;
|
852 | }
|
853 |
|
854 | interface IFilterNumber {
|
855 | |
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 | (value: number | string, fractionSize?: number | string): string;
|
862 | }
|
863 |
|
864 | interface IFilterDate {
|
865 | |
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 | (date: Date | number | string, format?: string, timezone?: string): string;
|
874 | }
|
875 |
|
876 | interface IFilterJson {
|
877 | |
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 | (object: any, spacing?: number): string;
|
884 | }
|
885 |
|
886 | interface IFilterLowercase {
|
887 | |
888 |
|
889 |
|
890 | (value: string): string;
|
891 | }
|
892 |
|
893 | interface IFilterUppercase {
|
894 | |
895 |
|
896 |
|
897 | (value: string): string;
|
898 | }
|
899 |
|
900 | interface IFilterLimitTo {
|
901 | |
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 | <T>(input: T[], limit: string | number, begin?: string | number): T[];
|
909 | |
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 | (input: string | number, limit: string | number, begin?: string | number): string;
|
917 | }
|
918 |
|
919 | interface IFilterOrderBy {
|
920 | |
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 | <T>(
|
929 | array: T[],
|
930 | expression: string | ((value: T) => any) | Array<((value: T) => any) | string>,
|
931 | reverse?: boolean,
|
932 | comparator?: IFilterOrderByComparatorFunc,
|
933 | ): T[];
|
934 | }
|
935 |
|
936 | /**
|
937 | * $filterProvider - $filter - provider in module ng
|
938 | *
|
939 | * 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.
|
940 | *
|
941 | * see https://docs.angularjs.org/api/ng/provider/$filterProvider
|
942 | */
|
943 | interface IFilterProvider extends IServiceProvider {
|
944 | /**
|
945 | * register(name);
|
946 | *
|
947 | * @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).
|
948 | */
|
949 | register(name: string | {}): IServiceProvider;
|
950 | }
|
951 |
|
952 | ///////////////////////////////////////////////////////////////////////////
|
953 | // LocaleService
|
954 | // see http://docs.angularjs.org/api/ng/service/$locale
|
955 | ///////////////////////////////////////////////////////////////////////////
|
956 | interface ILocaleService {
|
957 | id: string;
|
958 |
|
959 | // These are not documented
|
960 | // Check angular's i18n files for exemples
|
961 | NUMBER_FORMATS: ILocaleNumberFormatDescriptor;
|
962 | DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor;
|
963 | pluralCat(num: any): string;
|
964 | }
|
965 |
|
966 | interface ILocaleNumberFormatDescriptor {
|
967 | DECIMAL_SEP: string;
|
968 | GROUP_SEP: string;
|
969 | PATTERNS: ILocaleNumberPatternDescriptor[];
|
970 | CURRENCY_SYM: string;
|
971 | }
|
972 |
|
973 | interface ILocaleNumberPatternDescriptor {
|
974 | minInt: number;
|
975 | minFrac: number;
|
976 | maxFrac: number;
|
977 | posPre: string;
|
978 | posSuf: string;
|
979 | negPre: string;
|
980 | negSuf: string;
|
981 | gSize: number;
|
982 | lgSize: number;
|
983 | }
|
984 |
|
985 | interface ILocaleDateTimeFormatDescriptor {
|
986 | MONTH: string[];
|
987 | SHORTMONTH: string[];
|
988 | DAY: string[];
|
989 | SHORTDAY: string[];
|
990 | AMPMS: string[];
|
991 | medium: string;
|
992 | short: string;
|
993 | fullDate: string;
|
994 | longDate: string;
|
995 | mediumDate: string;
|
996 | shortDate: string;
|
997 | mediumTime: string;
|
998 | shortTime: string;
|
999 | }
|
1000 |
|
1001 | ///////////////////////////////////////////////////////////////////////////
|
1002 | // LogService
|
1003 | // see http://docs.angularjs.org/api/ng/service/$log
|
1004 | // see http://docs.angularjs.org/api/ng/provider/$logProvider
|
1005 | ///////////////////////////////////////////////////////////////////////////
|
1006 | interface ILogService {
|
1007 | debug: ILogCall;
|
1008 | error: ILogCall;
|
1009 | info: ILogCall;
|
1010 | log: ILogCall;
|
1011 | warn: ILogCall;
|
1012 | }
|
1013 |
|
1014 | interface ILogProvider extends IServiceProvider {
|
1015 | debugEnabled(): boolean;
|
1016 | debugEnabled(enabled: boolean): ILogProvider;
|
1017 | }
|
1018 |
|
1019 | // We define this as separate interface so we can reopen it later for
|
1020 | // the ngMock module.
|
1021 | interface ILogCall {
|
1022 | (...args: any[]): void;
|
1023 | }
|
1024 |
|
1025 | ///////////////////////////////////////////////////////////////////////////
|
1026 | // ParseService
|
1027 | // see http://docs.angularjs.org/api/ng/service/$parse
|
1028 | // see http://docs.angularjs.org/api/ng/provider/$parseProvider
|
1029 | ///////////////////////////////////////////////////////////////////////////
|
1030 | interface IParseService {
|
1031 | (
|
1032 | expression: string,
|
1033 | interceptorFn?: (value: any, scope: IScope, locals: any) => any,
|
1034 | expensiveChecks?: boolean,
|
1035 | ): ICompiledExpression;
|
1036 | }
|
1037 |
|
1038 | interface IParseProvider {
|
1039 | logPromiseWarnings(): boolean;
|
1040 | logPromiseWarnings(value: boolean): IParseProvider;
|
1041 |
|
1042 | unwrapPromises(): boolean;
|
1043 | unwrapPromises(value: boolean): IParseProvider;
|
1044 |
|
1045 | /**
|
1046 | * Configure $parse service to add literal values that will be present as literal at expressions.
|
1047 | *
|
1048 | * @param literalName Token for the literal value. The literal name value must be a valid literal name.
|
1049 | * @param literalValue Value for this literal. All literal values must be primitives or `undefined`.
|
1050 | */
|
1051 | addLiteral(literalName: string, literalValue: any): void;
|
1052 |
|
1053 | /**
|
1054 | * 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.
|
1055 | * 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.
|
1056 | *
|
1057 | * @param identifierStart The function that will decide whether the given character is a valid identifier start character.
|
1058 | * @param identifierContinue The function that will decide whether the given character is a valid identifier continue character.
|
1059 | */
|
1060 | setIdentifierFns(
|
1061 | identifierStart?: (character: string, codePoint: number) => boolean,
|
1062 | identifierContinue?: (character: string, codePoint: number) => boolean,
|
1063 | ): void;
|
1064 | }
|
1065 |
|
1066 | interface ICompiledExpression {
|
1067 | (context: any, locals?: any): any;
|
1068 |
|
1069 | literal: boolean;
|
1070 | constant: boolean;
|
1071 |
|
1072 | // If value is not provided, undefined is gonna be used since the implementation
|
1073 | // does not check the parameter. Let's force a value for consistency. If consumer
|
1074 | // whants to undefine it, pass the undefined value explicitly.
|
1075 | assign(context: any, value: any): any;
|
1076 | }
|
1077 |
|
1078 | /**
|
1079 | * $location - $locationProvider - service in module ng
|
1080 | * see https://docs.angularjs.org/api/ng/service/$location
|
1081 | */
|
1082 | interface ILocationService {
|
1083 | absUrl(): string;
|
1084 |
|
1085 | /**
|
1086 | * Returns the hash fragment
|
1087 | */
|
1088 | hash(): string;
|
1089 |
|
1090 | /**
|
1091 | * Changes the hash fragment and returns `$location`
|
1092 | */
|
1093 | hash(newHash: string | null): ILocationService;
|
1094 |
|
1095 | host(): string;
|
1096 |
|
1097 | /**
|
1098 | * Return path of current url
|
1099 | */
|
1100 | path(): string;
|
1101 |
|
1102 | /**
|
1103 | * Change path when called with parameter and return $location.
|
1104 | * Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing.
|
1105 | *
|
1106 | * @param path New path
|
1107 | */
|
1108 | path(path: string): ILocationService;
|
1109 |
|
1110 | port(): number;
|
1111 | protocol(): string;
|
1112 | replace(): ILocationService;
|
1113 |
|
1114 | /**
|
1115 | * Return search part (as object) of current url
|
1116 | */
|
1117 | search(): any;
|
1118 |
|
1119 | /**
|
1120 | * Change search part when called with parameter and return $location.
|
1121 | *
|
1122 | * @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value.
|
1123 | *
|
1124 | * If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url.
|
1125 | */
|
1126 | search(search: any): ILocationService;
|
1127 |
|
1128 | /**
|
1129 | * Change search part when called with parameter and return $location.
|
1130 | *
|
1131 | * @param search New search params
|
1132 | * @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.
|
1133 | */
|
1134 | search(search: string, paramValue: string | number | null | string[] | boolean): ILocationService;
|
1135 |
|
1136 | state(): any;
|
1137 | state(state: any): ILocationService;
|
1138 | url(): string;
|
1139 | url(url: string): ILocationService;
|
1140 | }
|
1141 |
|
1142 | interface ILocationProvider extends IServiceProvider {
|
1143 | hashPrefix(): string;
|
1144 | hashPrefix(prefix: string): ILocationProvider;
|
1145 | html5Mode(): boolean;
|
1146 |
|
1147 | // Documentation states that parameter is string, but
|
1148 | // implementation tests it as boolean, which makes more sense
|
1149 | // since this is a toggler
|
1150 | html5Mode(active: boolean): ILocationProvider;
|
1151 | html5Mode(
|
1152 | mode: {
|
1153 | enabled?: boolean | undefined;
|
1154 | requireBase?: boolean | undefined;
|
1155 | rewriteLinks?: boolean | undefined;
|
1156 | },
|
1157 | ): ILocationProvider;
|
1158 | }
|
1159 |
|
1160 | ///////////////////////////////////////////////////////////////////////////
|
1161 | // DocumentService
|
1162 | // see http://docs.angularjs.org/api/ng/service/$document
|
1163 | ///////////////////////////////////////////////////////////////////////////
|
1164 | interface IDocumentService extends JQLite {
|
1165 | // Must return intersection type for index signature compatibility with JQuery
|
1166 | [index: number]: HTMLElement & Document;
|
1167 | }
|
1168 |
|
1169 | ///////////////////////////////////////////////////////////////////////////
|
1170 | // ExceptionHandlerService
|
1171 | // see http://docs.angularjs.org/api/ng/service/$exceptionHandler
|
1172 | ///////////////////////////////////////////////////////////////////////////
|
1173 | interface IExceptionHandlerService {
|
1174 | (exception: Error, cause?: string): void;
|
1175 | }
|
1176 |
|
1177 | ///////////////////////////////////////////////////////////////////////////
|
1178 | // RootElementService
|
1179 | // see http://docs.angularjs.org/api/ng/service/$rootElement
|
1180 | ///////////////////////////////////////////////////////////////////////////
|
1181 | interface IRootElementService extends JQLite {}
|
1182 |
|
1183 | interface IQResolveReject<T> {
|
1184 | (): void;
|
1185 | (value: T): void;
|
1186 | }
|
1187 | /**
|
1188 | * $q - service in module ng
|
1189 | * A promise/deferred implementation inspired by Kris Kowal's Q.
|
1190 | * See http://docs.angularjs.org/api/ng/service/$q
|
1191 | */
|
1192 | interface IQService {
|
1193 | new<T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>;
|
1194 | <T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>;
|
1195 |
|
1196 | /**
|
1197 | * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
|
1198 | *
|
1199 | * 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.
|
1200 | *
|
1201 | * @param promises An array of promises.
|
1202 | */
|
1203 | all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
|
1204 | values: [
|
1205 | T1 | IPromise<T1>,
|
1206 | T2 | IPromise<T2>,
|
1207 | T3 | IPromise<T3>,
|
1208 | T4 | IPromise<T4>,
|
1209 | T5 | IPromise<T5>,
|
1210 | T6 | IPromise<T6>,
|
1211 | T7 | IPromise<T7>,
|
1212 | T8 | IPromise<T8>,
|
1213 | T9 | IPromise<T9>,
|
1214 | T10 | IPromise<T10>,
|
1215 | ],
|
1216 | ): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
1217 | all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
|
1218 | values: [
|
1219 | T1 | IPromise<T1>,
|
1220 | T2 | IPromise<T2>,
|
1221 | T3 | IPromise<T3>,
|
1222 | T4 | IPromise<T4>,
|
1223 | T5 | IPromise<T5>,
|
1224 | T6 | IPromise<T6>,
|
1225 | T7 | IPromise<T7>,
|
1226 | T8 | IPromise<T8>,
|
1227 | T9 | IPromise<T9>,
|
1228 | ],
|
1229 | ): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
1230 | all<T1, T2, T3, T4, T5, T6, T7, T8>(
|
1231 | values: [
|
1232 | T1 | IPromise<T1>,
|
1233 | T2 | IPromise<T2>,
|
1234 | T3 | IPromise<T3>,
|
1235 | T4 | IPromise<T4>,
|
1236 | T5 | IPromise<T5>,
|
1237 | T6 | IPromise<T6>,
|
1238 | T7 | IPromise<T7>,
|
1239 | T8 | IPromise<T8>,
|
1240 | ],
|
1241 | ): IPromise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
1242 | all<T1, T2, T3, T4, T5, T6, T7>(
|
1243 | values: [
|
1244 | T1 | IPromise<T1>,
|
1245 | T2 | IPromise<T2>,
|
1246 | T3 | IPromise<T3>,
|
1247 | T4 | IPromise<T4>,
|
1248 | T5 | IPromise<T5>,
|
1249 | T6 | IPromise<T6>,
|
1250 | T7 | IPromise<T7>,
|
1251 | ],
|
1252 | ): IPromise<[T1, T2, T3, T4, T5, T6, T7]>;
|
1253 | all<T1, T2, T3, T4, T5, T6>(
|
1254 | values: [
|
1255 | T1 | IPromise<T1>,
|
1256 | T2 | IPromise<T2>,
|
1257 | T3 | IPromise<T3>,
|
1258 | T4 | IPromise<T4>,
|
1259 | T5 | IPromise<T5>,
|
1260 | T6 | IPromise<T6>,
|
1261 | ],
|
1262 | ): IPromise<[T1, T2, T3, T4, T5, T6]>;
|
1263 | all<T1, T2, T3, T4, T5>(
|
1264 | values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>],
|
1265 | ): IPromise<[T1, T2, T3, T4, T5]>;
|
1266 | all<T1, T2, T3, T4>(
|
1267 | values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>],
|
1268 | ): IPromise<[T1, T2, T3, T4]>;
|
1269 | all<T1, T2, T3>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>]): IPromise<[T1, T2, T3]>;
|
1270 | all<T1, T2>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>]): IPromise<[T1, T2]>;
|
1271 | all<TAll>(promises: Array<TAll | IPromise<TAll>>): IPromise<TAll[]>;
|
1272 | /**
|
1273 | * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
|
1274 | *
|
1275 | * 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.
|
1276 | *
|
1277 | * @param promises A hash of promises.
|
1278 | */
|
1279 | all<T>(promises: { [K in keyof T]: (IPromise<T[K]> | T[K]) }): IPromise<T>;
|
1280 | /**
|
1281 | * Creates a Deferred object which represents a task which will finish in the future.
|
1282 | */
|
1283 | defer<T>(): IDeferred<T>;
|
1284 | /**
|
1285 | * 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.
|
1286 | *
|
1287 | * @param promises A list or hash of promises.
|
1288 | */
|
1289 | race<T>(promises: Array<IPromise<T>> | { [key: string]: IPromise<T> }): IPromise<T>;
|
1290 | /**
|
1291 | * 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.
|
1292 | *
|
1293 | * 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.
|
1294 | *
|
1295 | * @param reason Constant, message, exception or an object representing the rejection reason.
|
1296 | */
|
1297 | reject(reason?: any): IPromise<never>;
|
1298 | /**
|
1299 | * 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.
|
1300 | *
|
1301 | * @param value Value or a promise
|
1302 | */
|
1303 | resolve<T>(value: PromiseLike<T> | T): IPromise<T>;
|
1304 | /**
|
1305 | * @deprecated Since TS 2.4, inference is stricter and no longer produces the desired type when T1 !== T2.
|
1306 | * To use resolve with two different types, pass a union type to the single-type-argument overload.
|
1307 | */
|
1308 | resolve<T1, T2>(value: PromiseLike<T1> | T2): IPromise<T1 | T2>;
|
1309 | /**
|
1310 | * 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.
|
1311 | */
|
1312 | resolve(): IPromise<void>;
|
1313 | /**
|
1314 | * 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.
|
1315 | *
|
1316 | * @param value Value or a promise
|
1317 | */
|
1318 | when<T>(value: PromiseLike<T> | T): IPromise<T>;
|
1319 | when<T1, T2>(value: PromiseLike<T1> | T2): IPromise<T1 | T2>;
|
1320 | when<TResult, T>(
|
1321 | value: PromiseLike<T> | T,
|
1322 | successCallback: (promiseValue: T) => PromiseLike<TResult> | TResult,
|
1323 | ): IPromise<TResult>;
|
1324 | when<TResult, T>(
|
1325 | value: T,
|
1326 | successCallback: (promiseValue: T) => PromiseLike<TResult> | TResult,
|
1327 | errorCallback: null | undefined | ((reason: any) => any),
|
1328 | notifyCallback?: (state: any) => any,
|
1329 | ): IPromise<TResult>;
|
1330 | when<TResult, TResult2, T>(
|
1331 | value: PromiseLike<T>,
|
1332 | successCallback: (promiseValue: T) => PromiseLike<TResult> | TResult,
|
1333 | errorCallback: (reason: any) => TResult2 | PromiseLike<TResult2>,
|
1334 | notifyCallback?: (state: any) => any,
|
1335 | ): IPromise<TResult | TResult2>;
|
1336 | /**
|
1337 | * 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.
|
1338 | */
|
1339 | when(): IPromise<void>;
|
1340 | }
|
1341 |
|
1342 | interface IQProvider {
|
1343 | /**
|
1344 | * Retrieves or overrides whether to generate an error when a rejected promise is not handled.
|
1345 | * This feature is enabled by default.
|
1346 | *
|
1347 | * @returns Current value
|
1348 | */
|
1349 | errorOnUnhandledRejections(): boolean;
|
1350 |
|
1351 | /**
|
1352 | * Retrieves or overrides whether to generate an error when a rejected promise is not handled.
|
1353 | * This feature is enabled by default.
|
1354 | *
|
1355 | * @param value Whether to generate an error when a rejected promise is not handled.
|
1356 | * @returns Self for chaining otherwise.
|
1357 | */
|
1358 | errorOnUnhandledRejections(value: boolean): IQProvider;
|
1359 | }
|
1360 |
|
1361 | interface IPromise<T> {
|
1362 | /**
|
1363 | * Regardless of when the promise was or will be resolved or rejected, then calls one of
|
1364 | * the success or error callbacks asynchronously as soon as the result is available. The
|
1365 | * callbacks are called with a single argument: the result or rejection reason.
|
1366 | * Additionally, the notify callback may be called zero or more times to provide a
|
1367 | * progress indication, before the promise is resolved or rejected.
|
1368 | * The `successCallBack` may return `IPromise<never>` for when a `$q.reject()` needs to
|
1369 | * be returned.
|
1370 | * This method returns a new promise which is resolved or rejected via the return value
|
1371 | * of the `successCallback`, `errorCallback`. It also notifies via the return value of
|
1372 | * the `notifyCallback` method. The promise can not be resolved or rejected from the
|
1373 | * `notifyCallback` method.
|
1374 | */
|
1375 | then<TResult1 = T, TResult2 = never>(
|
1376 | successCallback?:
|
1377 | | ((value: T) => PromiseLike<never> | PromiseLike<TResult1> | TResult1)
|
1378 | | null,
|
1379 | errorCallback?:
|
1380 | | ((reason: any) => PromiseLike<never> | PromiseLike<TResult2> | TResult2)
|
1381 | | null,
|
1382 | notifyCallback?: (state: any) => any,
|
1383 | ): IPromise<TResult1 | TResult2>;
|
1384 | then<TResult1 = T, TResult2 = never>(
|
1385 | successCallback?:
|
1386 | | ((value: T) => IPromise<never> | IPromise<TResult1> | TResult1)
|
1387 | | null,
|
1388 | errorCallback?:
|
1389 | | ((reason: any) => IPromise<never> | IPromise<TResult2> | TResult2)
|
1390 | | null,
|
1391 | notifyCallback?: (state: any) => any,
|
1392 | ): IPromise<TResult1 | TResult2>;
|
1393 |
|
1394 | /**
|
1395 | * Shorthand for promise.then(null, errorCallback)
|
1396 | */
|
1397 | catch<TResult = never>(
|
1398 | onRejected?:
|
1399 | | ((reason: any) => PromiseLike<never> | PromiseLike<TResult> | TResult)
|
1400 | | null,
|
1401 | ): IPromise<T | TResult>;
|
1402 | catch<TResult = never>(
|
1403 | onRejected?:
|
1404 | | ((reason: any) => IPromise<never> | IPromise<TResult> | TResult)
|
1405 | | null,
|
1406 | ): IPromise<T | TResult>;
|
1407 |
|
1408 | /**
|
1409 | * 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.
|
1410 | *
|
1411 | * 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.
|
1412 | */
|
1413 | finally(finallyCallback: () => void): IPromise<T>;
|
1414 | }
|
1415 |
|
1416 | interface IDeferred<T> {
|
1417 | resolve(value?: T | IPromise<T>): void;
|
1418 | reject(reason?: any): void;
|
1419 | notify(state?: any): void;
|
1420 | promise: IPromise<T>;
|
1421 | }
|
1422 |
|
1423 | ///////////////////////////////////////////////////////////////////////////
|
1424 | // AnchorScrollService
|
1425 | // see http://docs.angularjs.org/api/ng/service/$anchorScroll
|
1426 | ///////////////////////////////////////////////////////////////////////////
|
1427 | interface IAnchorScrollService {
|
1428 | (): void;
|
1429 | (hash: string): void;
|
1430 | yOffset: any;
|
1431 | }
|
1432 |
|
1433 | interface IAnchorScrollProvider extends IServiceProvider {
|
1434 | disableAutoScrolling(): void;
|
1435 | }
|
1436 |
|
1437 | /**
|
1438 | * $cacheFactory - service in module ng
|
1439 | *
|
1440 | * Factory that constructs Cache objects and gives access to them.
|
1441 | *
|
1442 | * see https://docs.angularjs.org/api/ng/service/$cacheFactory
|
1443 | */
|
1444 | interface ICacheFactoryService {
|
1445 | /**
|
1446 | * Factory that constructs Cache objects and gives access to them.
|
1447 | *
|
1448 | * @param cacheId Name or id of the newly created cache.
|
1449 | * @param optionsMap Options object that specifies the cache behavior. Properties:
|
1450 | *
|
1451 | * capacity — turns the cache into LRU cache.
|
1452 | */
|
1453 | (cacheId: string, optionsMap?: { capacity?: number | undefined }): ICacheObject;
|
1454 |
|
1455 | /**
|
1456 | * Get information about all the caches that have been created.
|
1457 | * @returns key-value map of cacheId to the result of calling cache#info
|
1458 | */
|
1459 | info(): any;
|
1460 |
|
1461 | /**
|
1462 | * Get access to a cache object by the cacheId used when it was created.
|
1463 | *
|
1464 | * @param cacheId Name or id of a cache to access.
|
1465 | */
|
1466 | get(cacheId: string): ICacheObject;
|
1467 | }
|
1468 |
|
1469 | /**
|
1470 | * $cacheFactory.Cache - type in module ng
|
1471 | *
|
1472 | * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data.
|
1473 | *
|
1474 | * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache
|
1475 | */
|
1476 | interface ICacheObject {
|
1477 | /**
|
1478 | * Retrieve information regarding a particular Cache.
|
1479 | */
|
1480 | info(): {
|
1481 | /**
|
1482 | * the id of the cache instance
|
1483 | */
|
1484 | id: string;
|
1485 |
|
1486 | /**
|
1487 | * the number of entries kept in the cache instance
|
1488 | */
|
1489 | size: number;
|
1490 | // ...: any additional properties from the options object when creating the cache.
|
1491 | };
|
1492 |
|
1493 | /**
|
1494 | * 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.
|
1495 | *
|
1496 | * It will not insert undefined values into the cache.
|
1497 | *
|
1498 | * @param key the key under which the cached data is stored.
|
1499 | * @param value the value to store alongside the key. If it is undefined, the key will not be stored.
|
1500 | */
|
1501 | put<T>(key: string, value?: T): T;
|
1502 |
|
1503 | /**
|
1504 | * Retrieves named data stored in the Cache object.
|
1505 | *
|
1506 | * @param key the key of the data to be retrieved
|
1507 | */
|
1508 | get<T>(key: string): T | undefined;
|
1509 |
|
1510 | /**
|
1511 | * Removes an entry from the Cache object.
|
1512 | *
|
1513 | * @param key the key of the entry to be removed
|
1514 | */
|
1515 | remove(key: string): void;
|
1516 |
|
1517 | /**
|
1518 | * Clears the cache object of any entries.
|
1519 | */
|
1520 | removeAll(): void;
|
1521 |
|
1522 | /**
|
1523 | * Destroys the Cache object entirely, removing it from the $cacheFactory set.
|
1524 | */
|
1525 | destroy(): void;
|
1526 | }
|
1527 |
|
1528 | ///////////////////////////////////////////////////////////////////////////
|
1529 | // CompileService
|
1530 | // see http://docs.angularjs.org/api/ng/service/$compile
|
1531 | // see http://docs.angularjs.org/api/ng/provider/$compileProvider
|
1532 | ///////////////////////////////////////////////////////////////////////////
|
1533 | interface ICompileService {
|
1534 | (
|
1535 | element: string | Element | JQuery,
|
1536 | transclude?: ITranscludeFunction,
|
1537 | maxPriority?: number,
|
1538 | ): ITemplateLinkingFunction;
|
1539 | }
|
1540 |
|
1541 | interface ICompileProvider extends IServiceProvider {
|
1542 | directive<
|
1543 | TScope extends IScope = IScope,
|
1544 | TElement extends JQLite = JQLite,
|
1545 | TAttributes extends IAttributes = IAttributes,
|
1546 | TController extends IDirectiveController = IController,
|
1547 | >(
|
1548 | name: string,
|
1549 | directiveFactory: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>,
|
1550 | ): ICompileProvider;
|
1551 | directive<
|
1552 | TScope extends IScope = IScope,
|
1553 | TElement extends JQLite = JQLite,
|
1554 | TAttributes extends IAttributes = IAttributes,
|
1555 | TController extends IDirectiveController = IController,
|
1556 | >(
|
1557 | object: {
|
1558 | [directiveName: string]: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>;
|
1559 | },
|
1560 | ): ICompileProvider;
|
1561 |
|
1562 | component(name: string, options: IComponentOptions): ICompileProvider;
|
1563 | component(object: { [componentName: string]: IComponentOptions }): ICompileProvider;
|
1564 |
|
1565 | /** @deprecated The old name of aHrefSanitizationTrustedUrlList. Kept for compatibility. */
|
1566 | aHrefSanitizationWhitelist(): RegExp;
|
1567 | /** @deprecated The old name of aHrefSanitizationTrustedUrlList. Kept for compatibility. */
|
1568 | aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider;
|
1569 |
|
1570 | aHrefSanitizationTrustedUrlList(): RegExp;
|
1571 | aHrefSanitizationTrustedUrlList(regexp: RegExp): ICompileProvider;
|
1572 |
|
1573 | /** @deprecated The old name of imgSrcSanitizationTrustedUrlList. Kept for compatibility. */
|
1574 | imgSrcSanitizationWhitelist(): RegExp;
|
1575 | /** @deprecated The old name of imgSrcSanitizationTrustedUrlList. Kept for compatibility. */
|
1576 | imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider;
|
1577 |
|
1578 | imgSrcSanitizationTrustedUrlList(): RegExp;
|
1579 | imgSrcSanitizationTrustedUrlList(regexp: RegExp): ICompileProvider;
|
1580 |
|
1581 | debugInfoEnabled(): boolean;
|
1582 | debugInfoEnabled(enabled: boolean): ICompileProvider;
|
1583 |
|
1584 | /**
|
1585 | * Sets the number of times $onChanges hooks can trigger new changes before giving up and assuming that the model is unstable.
|
1586 | * Increasing the TTL could have performance implications, so you should not change it without proper justification.
|
1587 | * Default: 10.
|
1588 | * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#onChangesTtl
|
1589 | */
|
1590 | onChangesTtl(): number;
|
1591 | onChangesTtl(limit: number): ICompileProvider;
|
1592 |
|
1593 | /**
|
1594 | * It indicates to the compiler whether or not directives on comments should be compiled.
|
1595 | * It results in a compilation performance gain since the compiler doesn't have to check comments when looking for directives.
|
1596 | * Defaults to true.
|
1597 | * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#commentDirectivesEnabled
|
1598 | */
|
1599 | commentDirectivesEnabled(): boolean;
|
1600 | commentDirectivesEnabled(enabled: boolean): ICompileProvider;
|
1601 |
|
1602 | /**
|
1603 | * It indicates to the compiler whether or not directives on element classes should be compiled.
|
1604 | * It results in a compilation performance gain since the compiler doesn't have to check element classes when looking for directives.
|
1605 | * Defaults to true.
|
1606 | * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#cssClassDirectivesEnabled
|
1607 | */
|
1608 | cssClassDirectivesEnabled(): boolean;
|
1609 | cssClassDirectivesEnabled(enabled: boolean): ICompileProvider;
|
1610 |
|
1611 | /**
|
1612 | * Call this method to enable/disable strict component bindings check.
|
1613 | * If enabled, the compiler will enforce that for all bindings of a
|
1614 | * component that are not set as optional with ?, an attribute needs
|
1615 | * to be provided on the component's HTML tag.
|
1616 | * Defaults to false.
|
1617 | * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#strictComponentBindingsEnabled
|
1618 | */
|
1619 | strictComponentBindingsEnabled(): boolean;
|
1620 | strictComponentBindingsEnabled(enabled: boolean): ICompileProvider;
|
1621 | }
|
1622 |
|
1623 | interface ICloneAttachFunction {
|
1624 | // Let's hint but not force cloneAttachFn's signature
|
1625 | (clonedElement?: JQLite, scope?: IScope): any;
|
1626 | }
|
1627 |
|
1628 | // This corresponds to the "publicLinkFn" returned by $compile.
|
1629 | interface ITemplateLinkingFunction {
|
1630 | (scope: IScope, cloneAttachFn?: ICloneAttachFunction, options?: ITemplateLinkingFunctionOptions): JQLite;
|
1631 | }
|
1632 |
|
1633 | interface ITemplateLinkingFunctionOptions {
|
1634 | parentBoundTranscludeFn?: ITranscludeFunction | undefined;
|
1635 | transcludeControllers?: {
|
1636 | [controller: string]: { instance: IController };
|
1637 | } | undefined;
|
1638 | futureParentElement?: JQuery | undefined;
|
1639 | }
|
1640 |
|
1641 | /**
|
1642 | * This corresponds to $transclude passed to controllers and to the transclude function passed to link functions.
|
1643 | * https://docs.angularjs.org/api/ng/service/$compile#-controller-
|
1644 | * http://teropa.info/blog/2015/06/09/transclusion.html
|
1645 | */
|
1646 | interface ITranscludeFunction {
|
1647 | // If the scope is provided, then the cloneAttachFn must be as well.
|
1648 | (scope: IScope, cloneAttachFn: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQLite;
|
1649 | // If one argument is provided, then it's assumed to be the cloneAttachFn.
|
1650 | (cloneAttachFn?: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQLite;
|
1651 |
|
1652 | /**
|
1653 | * Returns true if the specified slot contains content (i.e. one or more DOM nodes)
|
1654 | */
|
1655 | isSlotFilled(slotName: string): boolean;
|
1656 | }
|
1657 |
|
1658 | ///////////////////////////////////////////////////////////////////////////
|
1659 | // ControllerService
|
1660 | // see http://docs.angularjs.org/api/ng/service/$controller
|
1661 | // see http://docs.angularjs.org/api/ng/provider/$controllerProvider
|
1662 | ///////////////////////////////////////////////////////////////////////////
|
1663 |
|
1664 | /**
|
1665 | * The minimal local definitions required by $controller(ctrl, locals) calls.
|
1666 | */
|
1667 | interface IControllerLocals {
|
1668 | $scope: ng.IScope;
|
1669 | $element: JQuery;
|
1670 | }
|
1671 |
|
1672 | interface IControllerService {
|
1673 | // Although the documentation doesn't state this, locals are optional
|
1674 | <T>(controllerConstructor: new(...args: any[]) => T, locals?: any): T;
|
1675 | <T>(controllerConstructor: (...args: any[]) => T, locals?: any): T;
|
1676 | <T>(controllerName: string, locals?: any): T;
|
1677 | }
|
1678 |
|
1679 | interface IControllerProvider extends IServiceProvider {
|
1680 | register(name: string, controllerConstructor: Function): void;
|
1681 | register(name: string, dependencyAnnotatedConstructor: any[]): void;
|
1682 | }
|
1683 |
|
1684 | /**
|
1685 | * xhrFactory
|
1686 | * Replace or decorate this service to create your own custom XMLHttpRequest objects.
|
1687 | * see https://docs.angularjs.org/api/ng/service/$xhrFactory
|
1688 | */
|
1689 | interface IXhrFactory<T> {
|
1690 | (method: string, url: string): T;
|
1691 | }
|
1692 |
|
1693 | /**
|
1694 | * HttpService
|
1695 | * see http://docs.angularjs.org/api/ng/service/$http
|
1696 | */
|
1697 | interface IHttpService {
|
1698 | /**
|
1699 | * Object describing the request to be made and how it should be processed.
|
1700 | */
|
1701 | <T>(config: IRequestConfig): IHttpPromise<T>;
|
1702 |
|
1703 | /**
|
1704 | * Shortcut method to perform GET request.
|
1705 | *
|
1706 | * @param url Relative or absolute URL specifying the destination of the request
|
1707 | * @param config Optional configuration object
|
1708 | */
|
1709 | get<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
|
1710 |
|
1711 | /**
|
1712 | * Shortcut method to perform DELETE request.
|
1713 | *
|
1714 | * @param url Relative or absolute URL specifying the destination of the request
|
1715 | * @param config Optional configuration object
|
1716 | */
|
1717 | delete<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
|
1718 |
|
1719 | /**
|
1720 | * Shortcut method to perform HEAD request.
|
1721 | *
|
1722 | * @param url Relative or absolute URL specifying the destination of the request
|
1723 | * @param config Optional configuration object
|
1724 | */
|
1725 | head<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
|
1726 |
|
1727 | /**
|
1728 | * Shortcut method to perform JSONP request.
|
1729 | *
|
1730 | * @param url Relative or absolute URL specifying the destination of the request
|
1731 | * @param config Optional configuration object
|
1732 | */
|
1733 | jsonp<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
|
1734 |
|
1735 | /**
|
1736 | * Shortcut method to perform POST request.
|
1737 | *
|
1738 | * @param url Relative or absolute URL specifying the destination of the request
|
1739 | * @param data Request content
|
1740 | * @param config Optional configuration object
|
1741 | */
|
1742 | post<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>;
|
1743 |
|
1744 | /**
|
1745 | * Shortcut method to perform PUT request.
|
1746 | *
|
1747 | * @param url Relative or absolute URL specifying the destination of the request
|
1748 | * @param data Request content
|
1749 | * @param config Optional configuration object
|
1750 | */
|
1751 | put<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>;
|
1752 |
|
1753 | /**
|
1754 | * Shortcut method to perform PATCH request.
|
1755 | *
|
1756 | * @param url Relative or absolute URL specifying the destination of the request
|
1757 | * @param data Request content
|
1758 | * @param config Optional configuration object
|
1759 | */
|
1760 | patch<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>;
|
1761 |
|
1762 | /**
|
1763 | * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations.
|
1764 | */
|
1765 | defaults: IHttpProviderDefaults;
|
1766 |
|
1767 | /**
|
1768 | * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes.
|
1769 | */
|
1770 | pendingRequests: IRequestConfig[];
|
1771 | }
|
1772 |
|
1773 | /**
|
1774 | * Object describing the request to be made and how it should be processed.
|
1775 | * see http://docs.angularjs.org/api/ng/service/$http#usage
|
1776 | */
|
1777 | interface IRequestShortcutConfig extends IHttpProviderDefaults {
|
1778 | /**
|
1779 | * {Object.<string|Object>}
|
1780 | * 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.
|
1781 | */
|
1782 | params?: any;
|
1783 |
|
1784 | /**
|
1785 | * {string|Object}
|
1786 | * Data to be sent as the request message data.
|
1787 | */
|
1788 | data?: any;
|
1789 |
|
1790 | /**
|
1791 | * Timeout in milliseconds, or promise that should abort the request when resolved.
|
1792 | */
|
1793 | timeout?: number | IPromise<any> | undefined;
|
1794 |
|
1795 | /**
|
1796 | * See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype
|
1797 | */
|
1798 | responseType?: string | undefined;
|
1799 |
|
1800 | /**
|
1801 | * 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.
|
1802 | * If unspecified, $http.defaults.jsonpCallbackParam will be used by default. This property is only applicable to JSON-P requests.
|
1803 | */
|
1804 | jsonpCallbackParam?: string | undefined;
|
1805 | }
|
1806 |
|
1807 | /**
|
1808 | * Object describing the request to be made and how it should be processed.
|
1809 | * see http://docs.angularjs.org/api/ng/service/$http#usage
|
1810 | */
|
1811 | interface IRequestConfig extends IRequestShortcutConfig {
|
1812 | /**
|
1813 | * HTTP method (e.g. 'GET', 'POST', etc)
|
1814 | */
|
1815 | method: string;
|
1816 | /**
|
1817 | * Absolute or relative URL of the resource that is being requested.
|
1818 | */
|
1819 | url: string;
|
1820 | /**
|
1821 | * Event listeners to be bound to the XMLHttpRequest object.
|
1822 | * To bind events to the XMLHttpRequest upload object, use uploadEventHandlers. The handler will be called in the context of a $apply block.
|
1823 | */
|
1824 | eventHandlers?: { [type: string]: EventListenerOrEventListenerObject } | undefined;
|
1825 | /**
|
1826 | * Event listeners to be bound to the XMLHttpRequest upload object.
|
1827 | * To bind events to the XMLHttpRequest object, use eventHandlers. The handler will be called in the context of a $apply block.
|
1828 | */
|
1829 | uploadEventHandlers?: { [type: string]: EventListenerOrEventListenerObject } | undefined;
|
1830 | }
|
1831 |
|
1832 | interface IHttpHeadersGetter {
|
1833 | (): { [name: string]: string };
|
1834 | (headerName: string): string;
|
1835 | }
|
1836 |
|
1837 | interface IHttpPromiseCallback<T> {
|
1838 | (data: T, status: number, headers: IHttpHeadersGetter, config: IRequestConfig): void;
|
1839 | }
|
1840 |
|
1841 | interface IHttpResponse<T> {
|
1842 | data: T;
|
1843 | status: number;
|
1844 | headers: IHttpHeadersGetter;
|
1845 | config: IRequestConfig;
|
1846 | statusText: string;
|
1847 | /** Added in AngularJS 1.6.6 */
|
1848 | xhrStatus: "complete" | "error" | "timeout" | "abort";
|
1849 | }
|
1850 |
|
1851 | /** @deprecated The old name of IHttpResponse. Kept for compatibility. */
|
1852 | type IHttpPromiseCallbackArg<T> = IHttpResponse<T>;
|
1853 |
|
1854 | type IHttpPromise<T> = IPromise<IHttpResponse<T>>;
|
1855 |
|
1856 | // See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
|
1857 | interface IHttpRequestTransformer {
|
1858 | (data: any, headersGetter: IHttpHeadersGetter): any;
|
1859 | }
|
1860 |
|
1861 | // The definition of fields are the same as IHttpResponse
|
1862 | interface IHttpResponseTransformer {
|
1863 | (data: any, headersGetter: IHttpHeadersGetter, status: number): any;
|
1864 | }
|
1865 |
|
1866 | interface HttpHeaderType {
|
1867 | [requestType: string]: string | ((config: IRequestConfig) => string);
|
1868 | }
|
1869 |
|
1870 | interface IHttpRequestConfigHeaders {
|
1871 | [requestType: string]: any;
|
1872 | common?: any;
|
1873 | get?: any;
|
1874 | post?: any;
|
1875 | put?: any;
|
1876 | patch?: any;
|
1877 | }
|
1878 |
|
1879 | /**
|
1880 | * Object that controls the defaults for $http provider. Not all fields of IRequestShortcutConfig can be configured
|
1881 | * via defaults and the docs do not say which. The following is based on the inspection of the source code.
|
1882 | * https://docs.angularjs.org/api/ng/service/$http#defaults
|
1883 | * https://docs.angularjs.org/api/ng/service/$http#usage
|
1884 | * https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section
|
1885 | */
|
1886 | interface IHttpProviderDefaults {
|
1887 | /**
|
1888 | * {boolean|Cache}
|
1889 | * 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.
|
1890 | */
|
1891 | cache?: any;
|
1892 |
|
1893 | /**
|
1894 | * Transform function or an array of such functions. The transform function takes the http request body and
|
1895 | * headers and returns its transformed (typically serialized) version.
|
1896 | * @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses}
|
1897 | */
|
1898 | transformRequest?: IHttpRequestTransformer | IHttpRequestTransformer[] | undefined;
|
1899 |
|
1900 | /**
|
1901 | * Transform function or an array of such functions. The transform function takes the http response body and
|
1902 | * headers and returns its transformed (typically deserialized) version.
|
1903 | */
|
1904 | transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[] | undefined;
|
1905 |
|
1906 | /**
|
1907 | * Map of strings or functions which return strings representing HTTP headers to send to the server. If the
|
1908 | * return value of a function is null, the header will not be sent.
|
1909 | * The key of the map is the request verb in lower case. The "common" key applies to all requests.
|
1910 | * @see {@link https://docs.angularjs.org/api/ng/service/$http#setting-http-headers}
|
1911 | */
|
1912 | headers?: IHttpRequestConfigHeaders | undefined;
|
1913 |
|
1914 | /** Name of HTTP header to populate with the XSRF token. */
|
1915 | xsrfHeaderName?: string | undefined;
|
1916 |
|
1917 | /** Name of cookie containing the XSRF token. */
|
1918 | xsrfCookieName?: string | undefined;
|
1919 |
|
1920 | /**
|
1921 | * 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.
|
1922 | */
|
1923 | withCredentials?: boolean | undefined;
|
1924 |
|
1925 | /**
|
1926 | * A function used to the prepare string representation of request parameters (specified as an object). If
|
1927 | * specified as string, it is interpreted as a function registered with the $injector. Defaults to
|
1928 | * $httpParamSerializer.
|
1929 | */
|
1930 | paramSerializer?: string | ((obj: any) => string) | undefined;
|
1931 | }
|
1932 |
|
1933 | interface IHttpInterceptor {
|
1934 | request?(config: IRequestConfig): IRequestConfig | IPromise<IRequestConfig>;
|
1935 | requestError?(rejection: any): IRequestConfig | IPromise<IRequestConfig>;
|
1936 | response?<T>(response: IHttpResponse<T>): IPromise<IHttpResponse<T>> | IHttpResponse<T>;
|
1937 | responseError?<T>(rejection: any): IPromise<IHttpResponse<T>> | IHttpResponse<T>;
|
1938 | }
|
1939 |
|
1940 | interface IHttpInterceptorFactory {
|
1941 | (...args: any[]): IHttpInterceptor;
|
1942 | }
|
1943 |
|
1944 | interface IHttpProvider extends IServiceProvider {
|
1945 | defaults: IHttpProviderDefaults;
|
1946 |
|
1947 | /**
|
1948 | * Register service factories (names or implementations) for interceptors which are called before and after
|
1949 | * each request.
|
1950 | */
|
1951 | interceptors: Array<string | Injectable<IHttpInterceptorFactory>>;
|
1952 | useApplyAsync(): boolean;
|
1953 | useApplyAsync(value: boolean): IHttpProvider;
|
1954 |
|
1955 | /** @deprecated The old name of xsrfTrustedOrigins. Kept for compatibility. */
|
1956 | xsrfWhitelistedOrigins: string[];
|
1957 | /**
|
1958 | * Array containing URLs whose origins are trusted to receive the XSRF token.
|
1959 | */
|
1960 | xsrfTrustedOrigins: string[];
|
1961 | }
|
1962 |
|
1963 | ///////////////////////////////////////////////////////////////////////////
|
1964 | // HttpBackendService
|
1965 | // see http://docs.angularjs.org/api/ng/service/$httpBackend
|
1966 | // You should never need to use this service directly.
|
1967 | ///////////////////////////////////////////////////////////////////////////
|
1968 | interface IHttpBackendService {
|
1969 | // XXX Perhaps define callback signature in the future
|
1970 | (
|
1971 | method: string,
|
1972 | url: string,
|
1973 | post?: any,
|
1974 | callback?: Function,
|
1975 | headers?: any,
|
1976 | timeout?: number,
|
1977 | withCredentials?: boolean,
|
1978 | ): void;
|
1979 | }
|
1980 |
|
1981 | ///////////////////////////////////////////////////////////////////////////
|
1982 | // InterpolateService
|
1983 | // see http://docs.angularjs.org/api/ng/service/$interpolate
|
1984 | // see http://docs.angularjs.org/api/ng/provider/$interpolateProvider
|
1985 | ///////////////////////////////////////////////////////////////////////////
|
1986 | interface IInterpolateService {
|
1987 | (
|
1988 | text: string,
|
1989 | mustHaveExpression?: boolean,
|
1990 | trustedContext?: string,
|
1991 | allOrNothing?: boolean,
|
1992 | ): IInterpolationFunction;
|
1993 | endSymbol(): string;
|
1994 | startSymbol(): string;
|
1995 | }
|
1996 |
|
1997 | interface IInterpolationFunction {
|
1998 | (context: any): string;
|
1999 | }
|
2000 |
|
2001 | interface IInterpolateProvider extends IServiceProvider {
|
2002 | startSymbol(): string;
|
2003 | startSymbol(value: string): IInterpolateProvider;
|
2004 | endSymbol(): string;
|
2005 | endSymbol(value: string): IInterpolateProvider;
|
2006 | }
|
2007 |
|
2008 | ///////////////////////////////////////////////////////////////////////////
|
2009 | // TemplateCacheService
|
2010 | // see http://docs.angularjs.org/api/ng/service/$templateCache
|
2011 | ///////////////////////////////////////////////////////////////////////////
|
2012 | interface ITemplateCacheService extends ICacheObject {}
|
2013 |
|
2014 | ///////////////////////////////////////////////////////////////////////////
|
2015 | // SCEService
|
2016 | // see http://docs.angularjs.org/api/ng/service/$sce
|
2017 | ///////////////////////////////////////////////////////////////////////////
|
2018 | interface ISCEService {
|
2019 | |