bosun.org@v0.0.0-20210513094433-e25bc3e69a1f/annotate/web/static/js/typings/browser/ambient/angular/angular.d.ts (about) 1 // Compiled using typings@0.6.8 2 // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/17ef40452039d19e06dc2a3815ea898c505860fa/angularjs/angular.d.ts 3 // Type definitions for Angular JS 1.4+ 4 // Project: http://angularjs.org 5 // Definitions by: Diego Vilar <http://github.com/diegovilar> 6 // Definitions: https://github.com/borisyankov/DefinitelyTyped 7 8 9 10 declare var angular: angular.IAngularStatic; 11 12 // Support for painless dependency injection 13 interface Function { 14 $inject?: string[]; 15 } 16 17 // Collapse angular into ng 18 import ng = angular; 19 // Support AMD require 20 declare module 'angular' { 21 export = angular; 22 } 23 24 /////////////////////////////////////////////////////////////////////////////// 25 // ng module (angular.js) 26 /////////////////////////////////////////////////////////////////////////////// 27 declare module angular { 28 29 // not directly implemented, but ensures that constructed class implements $get 30 interface IServiceProviderClass { 31 new (...args: any[]): IServiceProvider; 32 } 33 34 interface IServiceProviderFactory { 35 (...args: any[]): IServiceProvider; 36 } 37 38 // All service providers extend this interface 39 interface IServiceProvider { 40 $get: any; 41 } 42 43 interface IAngularBootstrapConfig { 44 strictDi?: boolean; 45 debugInfoEnabled?: boolean; 46 } 47 48 /////////////////////////////////////////////////////////////////////////// 49 // AngularStatic 50 // see http://docs.angularjs.org/api 51 /////////////////////////////////////////////////////////////////////////// 52 interface IAngularStatic { 53 bind(context: any, fn: Function, ...args: any[]): Function; 54 55 /** 56 * Use this function to manually start up angular application. 57 * 58 * @param element DOM element which is the root of angular application. 59 * @param modules An array of modules to load into the application. 60 * Each item in the array should be the name of a predefined module or a (DI annotated) 61 * function that will be invoked by the injector as a config block. 62 * @param config an object for defining configuration options for the application. The following keys are supported: 63 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. 64 */ 65 bootstrap(element: string|Element|JQuery|Document, modules?: (string|Function|any[])[], config?: IAngularBootstrapConfig): auto.IInjectorService; 66 67 /** 68 * Creates a deep copy of source, which should be an object or an array. 69 * 70 * - If no destination is supplied, a copy of the object or array is created. 71 * - 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. 72 * - If source is not an object or array (inc. null and undefined), source is returned. 73 * - If source is identical to 'destination' an exception will be thrown. 74 * 75 * @param source The source that will be used to make a copy. Can be any type, including primitives, null, and undefined. 76 * @param destination Destination into which the source is copied. If provided, must be of the same type as source. 77 */ 78 copy<T>(source: T, destination?: T): T; 79 80 /** 81 * Wraps a raw DOM element or HTML string as a jQuery element. 82 * 83 * 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." 84 */ 85 element: IAugmentedJQueryStatic; 86 equals(value1: any, value2: any): boolean; 87 extend(destination: any, ...sources: any[]): any; 88 89 /** 90 * 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. 91 * 92 * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. 93 * 94 * @param obj Object to iterate over. 95 * @param iterator Iterator function. 96 * @param context Object to become context (this) for the iterator function. 97 */ 98 forEach<T>(obj: T[], iterator: (value: T, key: number) => any, context?: any): any; 99 /** 100 * 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. 101 * 102 * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. 103 * 104 * @param obj Object to iterate over. 105 * @param iterator Iterator function. 106 * @param context Object to become context (this) for the iterator function. 107 */ 108 forEach<T>(obj: { [index: string]: T; }, iterator: (value: T, key: string) => any, context?: any): any; 109 /** 110 * 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. 111 * 112 * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. 113 * 114 * @param obj Object to iterate over. 115 * @param iterator Iterator function. 116 * @param context Object to become context (this) for the iterator function. 117 */ 118 forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any; 119 120 fromJson(json: string): any; 121 identity<T>(arg?: T): T; 122 injector(modules?: any[], strictDi?: boolean): auto.IInjectorService; 123 isArray(value: any): boolean; 124 isDate(value: any): boolean; 125 isDefined(value: any): boolean; 126 isElement(value: any): boolean; 127 isFunction(value: any): boolean; 128 isNumber(value: any): boolean; 129 isObject(value: any): boolean; 130 isString(value: any): boolean; 131 isUndefined(value: any): boolean; 132 lowercase(str: string): string; 133 134 /** 135 * 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). 136 * 137 * Unlike extend(), merge() recursively descends into object properties of source objects, performing a deep copy. 138 * 139 * @param dst Destination object. 140 * @param src Source object(s). 141 */ 142 merge(dst: any, ...src: any[]): any; 143 144 /** 145 * 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. 146 * 147 * 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. 148 * 149 * @param name The name of the module to create or retrieve. 150 * @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. 151 * @param configFn Optional configuration function for the module. 152 */ 153 module( 154 name: string, 155 requires?: string[], 156 configFn?: Function): IModule; 157 158 noop(...args: any[]): void; 159 reloadWithDebugInfo(): void; 160 toJson(obj: any, pretty?: boolean): string; 161 uppercase(str: string): string; 162 version: { 163 full: string; 164 major: number; 165 minor: number; 166 dot: number; 167 codeName: string; 168 }; 169 170 /** 171 * If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called. 172 * @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. 173 */ 174 resumeBootstrap?(extraModules?: string[]): ng.auto.IInjectorService; 175 } 176 177 /////////////////////////////////////////////////////////////////////////// 178 // Module 179 // see http://docs.angularjs.org/api/angular.Module 180 /////////////////////////////////////////////////////////////////////////// 181 interface IModule { 182 animation(name: string, animationFactory: Function): IModule; 183 animation(name: string, inlineAnnotatedFunction: any[]): IModule; 184 animation(object: Object): IModule; 185 /** 186 * Use this method to register a component. 187 * 188 * @param name The name of the component. 189 * @param options A definition object passed into the component. 190 */ 191 component(name: string, options: IComponentOptions): IModule; 192 /** 193 * Use this method to register work which needs to be performed on module loading. 194 * 195 * @param configFn Execute this function on module load. Useful for service configuration. 196 */ 197 config(configFn: Function): IModule; 198 /** 199 * Use this method to register work which needs to be performed on module loading. 200 * 201 * @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration. 202 */ 203 config(inlineAnnotatedFunction: any[]): IModule; 204 config(object: Object): IModule; 205 /** 206 * 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. 207 * 208 * @param name The name of the constant. 209 * @param value The constant value. 210 */ 211 constant(name: string, value: any): IModule; 212 constant(object: Object): IModule; 213 /** 214 * The $controller service is used by Angular to create new controllers. 215 * 216 * This provider allows controller registration via the register method. 217 * 218 * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. 219 * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). 220 */ 221 controller(name: string, controllerConstructor: Function): IModule; 222 /** 223 * The $controller service is used by Angular to create new controllers. 224 * 225 * This provider allows controller registration via the register method. 226 * 227 * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. 228 * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). 229 */ 230 controller(name: string, inlineAnnotatedConstructor: any[]): IModule; 231 controller(object: Object): IModule; 232 /** 233 * Register a new directive with the compiler. 234 * 235 * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) 236 * @param directiveFactory An injectable directive factory function. 237 */ 238 directive(name: string, directiveFactory: IDirectiveFactory): IModule; 239 /** 240 * Register a new directive with the compiler. 241 * 242 * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) 243 * @param directiveFactory An injectable directive factory function. 244 */ 245 directive(name: string, inlineAnnotatedFunction: any[]): IModule; 246 directive(object: Object): IModule; 247 /** 248 * 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. 249 * 250 * @param name The name of the instance. 251 * @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). 252 */ 253 factory(name: string, $getFn: Function): IModule; 254 /** 255 * 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. 256 * 257 * @param name The name of the instance. 258 * @param inlineAnnotatedFunction The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). 259 */ 260 factory(name: string, inlineAnnotatedFunction: any[]): IModule; 261 factory(object: Object): IModule; 262 filter(name: string, filterFactoryFunction: Function): IModule; 263 filter(name: string, inlineAnnotatedFunction: any[]): IModule; 264 filter(object: Object): IModule; 265 provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule; 266 provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule; 267 provider(name: string, inlineAnnotatedConstructor: any[]): IModule; 268 provider(name: string, providerObject: IServiceProvider): IModule; 269 provider(object: Object): IModule; 270 /** 271 * 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. 272 */ 273 run(initializationFunction: Function): IModule; 274 /** 275 * 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. 276 */ 277 run(inlineAnnotatedFunction: any[]): IModule; 278 service(name: string, serviceConstructor: Function): IModule; 279 service(name: string, inlineAnnotatedConstructor: any[]): IModule; 280 service(object: Object): IModule; 281 /** 282 * 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. 283 284 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. 285 * 286 * @param name The name of the instance. 287 * @param value The value. 288 */ 289 value(name: string, value: any): IModule; 290 value(object: Object): IModule; 291 292 /** 293 * 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. 294 * @param name The name of the service to decorate 295 * @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. 296 */ 297 decorator(name:string, decoratorConstructor: Function): IModule; 298 decorator(name:string, inlineAnnotatedConstructor: any[]): IModule; 299 300 // Properties 301 name: string; 302 requires: string[]; 303 } 304 305 /////////////////////////////////////////////////////////////////////////// 306 // Attributes 307 // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes 308 /////////////////////////////////////////////////////////////////////////// 309 interface IAttributes { 310 /** 311 * this is necessary to be able to access the scoped attributes. it's not very elegant 312 * because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way 313 * this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656 314 */ 315 [name: string]: any; 316 317 /** 318 * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with x- or data-) to its normalized, camelCase form. 319 * 320 * Also there is special case for Moz prefix starting with upper case letter. 321 * 322 * For further information check out the guide on @see https://docs.angularjs.org/guide/directive#matching-directives 323 */ 324 $normalize(name: string): string; 325 326 /** 327 * Adds the CSS class value specified by the classVal parameter to the 328 * element. If animations are enabled then an animation will be triggered 329 * for the class addition. 330 */ 331 $addClass(classVal: string): void; 332 333 /** 334 * Removes the CSS class value specified by the classVal parameter from the 335 * element. If animations are enabled then an animation will be triggered for 336 * the class removal. 337 */ 338 $removeClass(classVal: string): void; 339 340 /** 341 * Set DOM element attribute value. 342 */ 343 $set(key: string, value: any): void; 344 345 /** 346 * Observes an interpolated attribute. 347 * The observer function will be invoked once during the next $digest 348 * following compilation. The observer is then invoked whenever the 349 * interpolated value changes. 350 */ 351 $observe<T>(name: string, fn: (value?: T) => any): Function; 352 353 /** 354 * A map of DOM element attribute names to the normalized name. This is needed 355 * to do reverse lookup from normalized name back to actual name. 356 */ 357 $attr: Object; 358 } 359 360 /** 361 * form.FormController - type in module ng 362 * see https://docs.angularjs.org/api/ng/type/form.FormController 363 */ 364 interface IFormController { 365 366 /** 367 * 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 368 */ 369 [name: string]: any; 370 371 $pristine: boolean; 372 $dirty: boolean; 373 $valid: boolean; 374 $invalid: boolean; 375 $submitted: boolean; 376 $error: any; 377 $addControl(control: INgModelController): void; 378 $removeControl(control: INgModelController): void; 379 $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController): void; 380 $setDirty(): void; 381 $setPristine(): void; 382 $commitViewValue(): void; 383 $rollbackViewValue(): void; 384 $setSubmitted(): void; 385 $setUntouched(): void; 386 } 387 388 /////////////////////////////////////////////////////////////////////////// 389 // NgModelController 390 // see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController 391 /////////////////////////////////////////////////////////////////////////// 392 interface INgModelController { 393 $render(): void; 394 $setValidity(validationErrorKey: string, isValid: boolean): void; 395 // Documentation states viewValue and modelValue to be a string but other 396 // types do work and it's common to use them. 397 $setViewValue(value: any, trigger?: string): void; 398 $setPristine(): void; 399 $setDirty(): void; 400 $validate(): void; 401 $setTouched(): void; 402 $setUntouched(): void; 403 $rollbackViewValue(): void; 404 $commitViewValue(): void; 405 $isEmpty(value: any): boolean; 406 407 $viewValue: any; 408 409 $modelValue: any; 410 411 $parsers: IModelParser[]; 412 $formatters: IModelFormatter[]; 413 $viewChangeListeners: IModelViewChangeListener[]; 414 $error: any; 415 $name: string; 416 417 $touched: boolean; 418 $untouched: boolean; 419 420 $validators: IModelValidators; 421 $asyncValidators: IAsyncModelValidators; 422 423 $pending: any; 424 $pristine: boolean; 425 $dirty: boolean; 426 $valid: boolean; 427 $invalid: boolean; 428 } 429 430 interface IModelValidators { 431 /** 432 * viewValue is any because it can be an object that is called in the view like $viewValue.name:$viewValue.subName 433 */ 434 [index: string]: (modelValue: any, viewValue: any) => boolean; 435 } 436 437 interface IAsyncModelValidators { 438 [index: string]: (modelValue: any, viewValue: any) => IPromise<any>; 439 } 440 441 interface IModelParser { 442 (value: any): any; 443 } 444 445 interface IModelFormatter { 446 (value: any): any; 447 } 448 449 interface IModelViewChangeListener { 450 (): void; 451 } 452 453 /** 454 * $rootScope - $rootScopeProvider - service in module ng 455 * see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope 456 */ 457 interface IRootScopeService { 458 [index: string]: any; 459 460 $apply(): any; 461 $apply(exp: string): any; 462 $apply(exp: (scope: IScope) => any): any; 463 464 $applyAsync(): any; 465 $applyAsync(exp: string): any; 466 $applyAsync(exp: (scope: IScope) => any): any; 467 468 /** 469 * Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners. 470 * 471 * 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. 472 * 473 * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. 474 * 475 * @param name Event name to broadcast. 476 * @param args Optional one or more arguments which will be passed onto the event listeners. 477 */ 478 $broadcast(name: string, ...args: any[]): IAngularEvent; 479 $destroy(): void; 480 $digest(): void; 481 /** 482 * Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners. 483 * 484 * 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. 485 * 486 * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. 487 * 488 * @param name Event name to emit. 489 * @param args Optional one or more arguments which will be passed onto the event listeners. 490 */ 491 $emit(name: string, ...args: any[]): IAngularEvent; 492 493 $eval(): any; 494 $eval(expression: string, locals?: Object): any; 495 $eval(expression: (scope: IScope) => any, locals?: Object): any; 496 497 $evalAsync(): void; 498 $evalAsync(expression: string): void; 499 $evalAsync(expression: (scope: IScope) => any): void; 500 501 // Defaults to false by the implementation checking strategy 502 $new(isolate?: boolean, parent?: IScope): IScope; 503 504 /** 505 * Listens on events of a given type. See $emit for discussion of event life cycle. 506 * 507 * The event listener function format is: function(event, args...). 508 * 509 * @param name Event name to listen on. 510 * @param listener Function to call when the event is emitted. 511 */ 512 $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function; 513 514 $watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function; 515 $watch<T>(watchExpression: string, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): Function; 516 $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function; 517 $watch<T>(watchExpression: (scope: IScope) => T, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): Function; 518 519 $watchCollection<T>(watchExpression: string, listener: (newValue: T, oldValue: T, scope: IScope) => any): Function; 520 $watchCollection<T>(watchExpression: (scope: IScope) => T, listener: (newValue: T, oldValue: T, scope: IScope) => any): Function; 521 522 $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; 523 $watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; 524 525 $parent: IScope; 526 $root: IRootScopeService; 527 $id: number; 528 529 // Hidden members 530 $$isolateBindings: any; 531 $$phase: any; 532 } 533 534 interface IScope extends IRootScopeService { } 535 536 /** 537 * $scope for ngRepeat directive. 538 * see https://docs.angularjs.org/api/ng/directive/ngRepeat 539 */ 540 interface IRepeatScope extends IScope { 541 542 /** 543 * iterator offset of the repeated element (0..length-1). 544 */ 545 $index: number; 546 547 /** 548 * true if the repeated element is first in the iterator. 549 */ 550 $first: boolean; 551 552 /** 553 * true if the repeated element is between the first and last in the iterator. 554 */ 555 $middle: boolean; 556 557 /** 558 * true if the repeated element is last in the iterator. 559 */ 560 $last: boolean; 561 562 /** 563 * true if the iterator position $index is even (otherwise false). 564 */ 565 $even: boolean; 566 567 /** 568 * true if the iterator position $index is odd (otherwise false). 569 */ 570 $odd: boolean; 571 572 } 573 574 interface IAngularEvent { 575 /** 576 * the scope on which the event was $emit-ed or $broadcast-ed. 577 */ 578 targetScope: IScope; 579 /** 580 * the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null. 581 */ 582 currentScope: IScope; 583 /** 584 * name of the event. 585 */ 586 name: string; 587 /** 588 * calling stopPropagation function will cancel further event propagation (available only for events that were $emit-ed). 589 */ 590 stopPropagation?: Function; 591 /** 592 * calling preventDefault sets defaultPrevented flag to true. 593 */ 594 preventDefault: Function; 595 /** 596 * true if preventDefault was called. 597 */ 598 defaultPrevented: boolean; 599 } 600 601 /////////////////////////////////////////////////////////////////////////// 602 // WindowService 603 // see http://docs.angularjs.org/api/ng.$window 604 /////////////////////////////////////////////////////////////////////////// 605 interface IWindowService extends Window { 606 [key: string]: any; 607 } 608 609 /////////////////////////////////////////////////////////////////////////// 610 // BrowserService 611 // TODO undocumented, so we need to get it from the source code 612 /////////////////////////////////////////////////////////////////////////// 613 interface IBrowserService { 614 defer: angular.ITimeoutService; 615 [key: string]: any; 616 } 617 618 /////////////////////////////////////////////////////////////////////////// 619 // TimeoutService 620 // see http://docs.angularjs.org/api/ng.$timeout 621 /////////////////////////////////////////////////////////////////////////// 622 interface ITimeoutService { 623 (delay?: number, invokeApply?: boolean): IPromise<void>; 624 <T>(fn: (...args: any[]) => T, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise<T>; 625 cancel(promise?: IPromise<any>): boolean; 626 } 627 628 /////////////////////////////////////////////////////////////////////////// 629 // IntervalService 630 // see http://docs.angularjs.org/api/ng.$interval 631 /////////////////////////////////////////////////////////////////////////// 632 interface IIntervalService { 633 (func: Function, delay: number, count?: number, invokeApply?: boolean, ...args: any[]): IPromise<any>; 634 cancel(promise: IPromise<any>): boolean; 635 } 636 637 /////////////////////////////////////////////////////////////////////////// 638 // AnimateProvider 639 // see http://docs.angularjs.org/api/ng/provider/$animateProvider 640 /////////////////////////////////////////////////////////////////////////// 641 interface IAnimateProvider { 642 /** 643 * Registers a new injectable animation factory function. 644 * 645 * @param name The name of the animation. 646 * @param factory The factory function that will be executed to return the animation object. 647 */ 648 register(name: string, factory: () => IAnimateCallbackObject): void; 649 650 /** 651 * Gets and/or sets the CSS class expression that is checked when performing an animation. 652 * 653 * @param expression The className expression which will be checked against all animations. 654 * @returns The current CSS className expression value. If null then there is no expression value. 655 */ 656 classNameFilter(expression?: RegExp): RegExp; 657 } 658 659 /** 660 * The animation object which contains callback functions for each event that is expected to be animated. 661 */ 662 interface IAnimateCallbackObject { 663 eventFn(element: Node, doneFn: () => void): Function; 664 } 665 666 /** 667 * $filter - $filterProvider - service in module ng 668 * 669 * Filters are used for formatting data displayed to the user. 670 * 671 * see https://docs.angularjs.org/api/ng/service/$filter 672 */ 673 interface IFilterService { 674 (name: 'filter'): IFilterFilter; 675 (name: 'currency'): IFilterCurrency; 676 (name: 'number'): IFilterNumber; 677 (name: 'date'): IFilterDate; 678 (name: 'json'): IFilterJson; 679 (name: 'lowercase'): IFilterLowercase; 680 (name: 'uppercase'): IFilterUppercase; 681 (name: 'limitTo'): IFilterLimitTo; 682 (name: 'orderBy'): IFilterOrderBy; 683 /** 684 * Usage: 685 * $filter(name); 686 * 687 * @param name Name of the filter function to retrieve 688 */ 689 <T>(name: string): T; 690 } 691 692 interface IFilterFilter { 693 <T>(array: T[], expression: string | IFilterFilterPatternObject | IFilterFilterPredicateFunc<T>, comparator?: IFilterFilterComparatorFunc<T>|boolean): T[]; 694 } 695 696 interface IFilterFilterPatternObject { 697 [name: string]: any; 698 } 699 700 interface IFilterFilterPredicateFunc<T> { 701 (value: T, index: number, array: T[]): boolean; 702 } 703 704 interface IFilterFilterComparatorFunc<T> { 705 (actual: T, expected: T): boolean; 706 } 707 708 interface IFilterCurrency { 709 /** 710 * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used. 711 * @param amount Input to filter. 712 * @param symbol Currency symbol or identifier to be displayed. 713 * @param fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale 714 * @return Formatted number 715 */ 716 (amount: number, symbol?: string, fractionSize?: number): string; 717 } 718 719 interface IFilterNumber { 720 /** 721 * Formats a number as text. 722 * @param number Number to format. 723 * @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. 724 * @return Number rounded to decimalPlaces and places a “,” after each third digit. 725 */ 726 (value: number|string, fractionSize?: number|string): string; 727 } 728 729 interface IFilterDate { 730 /** 731 * Formats date to a string based on the requested format. 732 * 733 * @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. 734 * @param format Formatting rules (see Description). If not specified, mediumDate is used. 735 * @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. 736 * @return Formatted string or the input if input is not recognized as date/millis. 737 */ 738 (date: Date | number | string, format?: string, timezone?: string): string; 739 } 740 741 interface IFilterJson { 742 /** 743 * Allows you to convert a JavaScript object into JSON string. 744 * @param object Any JavaScript object (including arrays and primitive types) to filter. 745 * @param spacing The number of spaces to use per indentation, defaults to 2. 746 * @return JSON string. 747 */ 748 (object: any, spacing?: number): string; 749 } 750 751 interface IFilterLowercase { 752 /** 753 * Converts string to lowercase. 754 */ 755 (value: string): string; 756 } 757 758 interface IFilterUppercase { 759 /** 760 * Converts string to uppercase. 761 */ 762 (value: string): string; 763 } 764 765 interface IFilterLimitTo { 766 /** 767 * 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. 768 * @param input Source array to be limited. 769 * @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. 770 * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0. 771 * @return A new sub-array of length limit or less if input array had less than limit elements. 772 */ 773 <T>(input: T[], limit: string|number, begin?: string|number): T[]; 774 /** 775 * 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. 776 * @param input Source string or number to be limited. 777 * @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. 778 * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0. 779 * @return A new substring of length limit or less if input had less than limit elements. 780 */ 781 (input: string|number, limit: string|number, begin?: string|number): string; 782 } 783 784 interface IFilterOrderBy { 785 /** 786 * 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. 787 * @param array The array to sort. 788 * @param expression A predicate to be used by the comparator to determine the order of elements. 789 * @param reverse Reverse the order of the array. 790 * @return Reverse the order of the array. 791 */ 792 <T>(array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean): T[]; 793 } 794 795 /** 796 * $filterProvider - $filter - provider in module ng 797 * 798 * 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. 799 * 800 * see https://docs.angularjs.org/api/ng/provider/$filterProvider 801 */ 802 interface IFilterProvider extends IServiceProvider { 803 /** 804 * register(name); 805 * 806 * @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). 807 */ 808 register(name: string | {}): IServiceProvider; 809 } 810 811 /////////////////////////////////////////////////////////////////////////// 812 // LocaleService 813 // see http://docs.angularjs.org/api/ng.$locale 814 /////////////////////////////////////////////////////////////////////////// 815 interface ILocaleService { 816 id: string; 817 818 // These are not documented 819 // Check angular's i18n files for exemples 820 NUMBER_FORMATS: ILocaleNumberFormatDescriptor; 821 DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor; 822 pluralCat: (num: any) => string; 823 } 824 825 interface ILocaleNumberFormatDescriptor { 826 DECIMAL_SEP: string; 827 GROUP_SEP: string; 828 PATTERNS: ILocaleNumberPatternDescriptor[]; 829 CURRENCY_SYM: string; 830 } 831 832 interface ILocaleNumberPatternDescriptor { 833 minInt: number; 834 minFrac: number; 835 maxFrac: number; 836 posPre: string; 837 posSuf: string; 838 negPre: string; 839 negSuf: string; 840 gSize: number; 841 lgSize: number; 842 } 843 844 interface ILocaleDateTimeFormatDescriptor { 845 MONTH: string[]; 846 SHORTMONTH: string[]; 847 DAY: string[]; 848 SHORTDAY: string[]; 849 AMPMS: string[]; 850 medium: string; 851 short: string; 852 fullDate: string; 853 longDate: string; 854 mediumDate: string; 855 shortDate: string; 856 mediumTime: string; 857 shortTime: string; 858 } 859 860 /////////////////////////////////////////////////////////////////////////// 861 // LogService 862 // see http://docs.angularjs.org/api/ng.$log 863 // see http://docs.angularjs.org/api/ng.$logProvider 864 /////////////////////////////////////////////////////////////////////////// 865 interface ILogService { 866 debug: ILogCall; 867 error: ILogCall; 868 info: ILogCall; 869 log: ILogCall; 870 warn: ILogCall; 871 } 872 873 interface ILogProvider extends IServiceProvider { 874 debugEnabled(): boolean; 875 debugEnabled(enabled: boolean): ILogProvider; 876 } 877 878 // We define this as separate interface so we can reopen it later for 879 // the ngMock module. 880 interface ILogCall { 881 (...args: any[]): void; 882 } 883 884 /////////////////////////////////////////////////////////////////////////// 885 // ParseService 886 // see http://docs.angularjs.org/api/ng.$parse 887 // see http://docs.angularjs.org/api/ng.$parseProvider 888 /////////////////////////////////////////////////////////////////////////// 889 interface IParseService { 890 (expression: string): ICompiledExpression; 891 } 892 893 interface IParseProvider { 894 logPromiseWarnings(): boolean; 895 logPromiseWarnings(value: boolean): IParseProvider; 896 897 unwrapPromises(): boolean; 898 unwrapPromises(value: boolean): IParseProvider; 899 } 900 901 interface ICompiledExpression { 902 (context: any, locals?: any): any; 903 904 literal: boolean; 905 constant: boolean; 906 907 // If value is not provided, undefined is gonna be used since the implementation 908 // does not check the parameter. Let's force a value for consistency. If consumer 909 // whants to undefine it, pass the undefined value explicitly. 910 assign(context: any, value: any): any; 911 } 912 913 /** 914 * $location - $locationProvider - service in module ng 915 * see https://docs.angularjs.org/api/ng/service/$location 916 */ 917 interface ILocationService { 918 absUrl(): string; 919 hash(): string; 920 hash(newHash: string): ILocationService; 921 host(): string; 922 923 /** 924 * Return path of current url 925 */ 926 path(): string; 927 928 /** 929 * Change path when called with parameter and return $location. 930 * Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing. 931 * 932 * @param path New path 933 */ 934 path(path: string): ILocationService; 935 936 port(): number; 937 protocol(): string; 938 replace(): ILocationService; 939 940 /** 941 * Return search part (as object) of current url 942 */ 943 search(): any; 944 945 /** 946 * Change search part when called with parameter and return $location. 947 * 948 * @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value. 949 * 950 * If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url. 951 */ 952 search(search: any): ILocationService; 953 954 /** 955 * Change search part when called with parameter and return $location. 956 * 957 * @param search New search params 958 * @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. 959 */ 960 search(search: string, paramValue: string|number|string[]|boolean): ILocationService; 961 962 state(): any; 963 state(state: any): ILocationService; 964 url(): string; 965 url(url: string): ILocationService; 966 } 967 968 interface ILocationProvider extends IServiceProvider { 969 hashPrefix(): string; 970 hashPrefix(prefix: string): ILocationProvider; 971 html5Mode(): boolean; 972 973 // Documentation states that parameter is string, but 974 // implementation tests it as boolean, which makes more sense 975 // since this is a toggler 976 html5Mode(active: boolean): ILocationProvider; 977 html5Mode(mode: { enabled?: boolean; requireBase?: boolean; rewriteLinks?: boolean; }): ILocationProvider; 978 } 979 980 /////////////////////////////////////////////////////////////////////////// 981 // DocumentService 982 // see http://docs.angularjs.org/api/ng.$document 983 /////////////////////////////////////////////////////////////////////////// 984 interface IDocumentService extends IAugmentedJQuery {} 985 986 /////////////////////////////////////////////////////////////////////////// 987 // ExceptionHandlerService 988 // see http://docs.angularjs.org/api/ng.$exceptionHandler 989 /////////////////////////////////////////////////////////////////////////// 990 interface IExceptionHandlerService { 991 (exception: Error, cause?: string): void; 992 } 993 994 /////////////////////////////////////////////////////////////////////////// 995 // RootElementService 996 // see http://docs.angularjs.org/api/ng.$rootElement 997 /////////////////////////////////////////////////////////////////////////// 998 interface IRootElementService extends JQuery {} 999 1000 interface IQResolveReject<T> { 1001 (): void; 1002 (value: T): void; 1003 } 1004 /** 1005 * $q - service in module ng 1006 * A promise/deferred implementation inspired by Kris Kowal's Q. 1007 * See http://docs.angularjs.org/api/ng/service/$q 1008 */ 1009 interface IQService { 1010 new <T>(resolver: (resolve: IQResolveReject<T>) => any): IPromise<T>; 1011 new <T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>; 1012 <T>(resolver: (resolve: IQResolveReject<T>) => any): IPromise<T>; 1013 <T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>; 1014 1015 /** 1016 * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. 1017 * 1018 * 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. 1019 * 1020 * @param promises An array of promises. 1021 */ 1022 all<T>(promises: IPromise<any>[]): IPromise<T[]>; 1023 /** 1024 * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. 1025 * 1026 * 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. 1027 * 1028 * @param promises A hash of promises. 1029 */ 1030 all(promises: { [id: string]: IPromise<any>; }): IPromise<{ [id: string]: any; }>; 1031 all<T extends {}>(promises: { [id: string]: IPromise<any>; }): IPromise<T>; 1032 /** 1033 * Creates a Deferred object which represents a task which will finish in the future. 1034 */ 1035 defer<T>(): IDeferred<T>; 1036 /** 1037 * 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. 1038 * 1039 * 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. 1040 * 1041 * @param reason Constant, message, exception or an object representing the rejection reason. 1042 */ 1043 reject(reason?: any): IPromise<any>; 1044 /** 1045 * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. 1046 * 1047 * @param value Value or a promise 1048 */ 1049 resolve<T>(value: IPromise<T>|T): IPromise<T>; 1050 /** 1051 * 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. 1052 */ 1053 resolve(): IPromise<void>; 1054 /** 1055 * 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. 1056 * 1057 * @param value Value or a promise 1058 */ 1059 when<T>(value: IPromise<T>|T): IPromise<T>; 1060 /** 1061 * 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. 1062 */ 1063 when(): IPromise<void>; 1064 } 1065 1066 interface IPromise<T> { 1067 /** 1068 * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. 1069 * The successCallBack may return IPromise<void> for when a $q.reject() needs to be returned 1070 * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. 1071 */ 1072 then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>; 1073 1074 /** 1075 * Shorthand for promise.then(null, errorCallback) 1076 */ 1077 catch<TResult>(onRejected: (reason: any) => IPromise<TResult>|TResult): IPromise<TResult>; 1078 1079 /** 1080 * 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. 1081 * 1082 * 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. 1083 */ 1084 finally(finallyCallback: () => any): IPromise<T>; 1085 } 1086 1087 interface IDeferred<T> { 1088 resolve(value?: T|IPromise<T>): void; 1089 reject(reason?: any): void; 1090 notify(state?: any): void; 1091 promise: IPromise<T>; 1092 } 1093 1094 /////////////////////////////////////////////////////////////////////////// 1095 // AnchorScrollService 1096 // see http://docs.angularjs.org/api/ng.$anchorScroll 1097 /////////////////////////////////////////////////////////////////////////// 1098 interface IAnchorScrollService { 1099 (): void; 1100 (hash: string): void; 1101 yOffset: any; 1102 } 1103 1104 interface IAnchorScrollProvider extends IServiceProvider { 1105 disableAutoScrolling(): void; 1106 } 1107 1108 /** 1109 * $cacheFactory - service in module ng 1110 * 1111 * Factory that constructs Cache objects and gives access to them. 1112 * 1113 * see https://docs.angularjs.org/api/ng/service/$cacheFactory 1114 */ 1115 interface ICacheFactoryService { 1116 /** 1117 * Factory that constructs Cache objects and gives access to them. 1118 * 1119 * @param cacheId Name or id of the newly created cache. 1120 * @param optionsMap Options object that specifies the cache behavior. Properties: 1121 * 1122 * capacity — turns the cache into LRU cache. 1123 */ 1124 (cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject; 1125 1126 /** 1127 * Get information about all the caches that have been created. 1128 * @returns key-value map of cacheId to the result of calling cache#info 1129 */ 1130 info(): any; 1131 1132 /** 1133 * Get access to a cache object by the cacheId used when it was created. 1134 * 1135 * @param cacheId Name or id of a cache to access. 1136 */ 1137 get(cacheId: string): ICacheObject; 1138 } 1139 1140 /** 1141 * $cacheFactory.Cache - type in module ng 1142 * 1143 * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data. 1144 * 1145 * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache 1146 */ 1147 interface ICacheObject { 1148 /** 1149 * Retrieve information regarding a particular Cache. 1150 */ 1151 info(): { 1152 /** 1153 * the id of the cache instance 1154 */ 1155 id: string; 1156 1157 /** 1158 * the number of entries kept in the cache instance 1159 */ 1160 size: number; 1161 1162 //...: any additional properties from the options object when creating the cache. 1163 }; 1164 1165 /** 1166 * 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. 1167 * 1168 * It will not insert undefined values into the cache. 1169 * 1170 * @param key the key under which the cached data is stored. 1171 * @param value the value to store alongside the key. If it is undefined, the key will not be stored. 1172 */ 1173 put<T>(key: string, value?: T): T; 1174 1175 /** 1176 * Retrieves named data stored in the Cache object. 1177 * 1178 * @param key the key of the data to be retrieved 1179 */ 1180 get<T>(key: string): T; 1181 1182 /** 1183 * Removes an entry from the Cache object. 1184 * 1185 * @param key the key of the entry to be removed 1186 */ 1187 remove(key: string): void; 1188 1189 /** 1190 * Clears the cache object of any entries. 1191 */ 1192 removeAll(): void; 1193 1194 /** 1195 * Destroys the Cache object entirely, removing it from the $cacheFactory set. 1196 */ 1197 destroy(): void; 1198 } 1199 1200 /////////////////////////////////////////////////////////////////////////// 1201 // CompileService 1202 // see http://docs.angularjs.org/api/ng.$compile 1203 // see http://docs.angularjs.org/api/ng.$compileProvider 1204 /////////////////////////////////////////////////////////////////////////// 1205 interface ICompileService { 1206 (element: string, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; 1207 (element: Element, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; 1208 (element: JQuery, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; 1209 } 1210 1211 interface ICompileProvider extends IServiceProvider { 1212 directive(name: string, directiveFactory: Function): ICompileProvider; 1213 1214 // Undocumented, but it is there... 1215 directive(directivesMap: any): ICompileProvider; 1216 1217 aHrefSanitizationWhitelist(): RegExp; 1218 aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider; 1219 1220 imgSrcSanitizationWhitelist(): RegExp; 1221 imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider; 1222 1223 debugInfoEnabled(enabled?: boolean): any; 1224 } 1225 1226 interface ICloneAttachFunction { 1227 // Let's hint but not force cloneAttachFn's signature 1228 (clonedElement?: JQuery, scope?: IScope): any; 1229 } 1230 1231 // This corresponds to the "publicLinkFn" returned by $compile. 1232 interface ITemplateLinkingFunction { 1233 (scope: IScope, cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; 1234 } 1235 1236 // This corresponds to $transclude (and also the transclude function passed to link). 1237 interface ITranscludeFunction { 1238 // If the scope is provided, then the cloneAttachFn must be as well. 1239 (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery; 1240 // If one argument is provided, then it's assumed to be the cloneAttachFn. 1241 (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; 1242 } 1243 1244 /////////////////////////////////////////////////////////////////////////// 1245 // ControllerService 1246 // see http://docs.angularjs.org/api/ng.$controller 1247 // see http://docs.angularjs.org/api/ng.$controllerProvider 1248 /////////////////////////////////////////////////////////////////////////// 1249 interface IControllerService { 1250 // Although the documentation doesn't state this, locals are optional 1251 <T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindToController?: any): T; 1252 <T>(controllerConstructor: Function, locals?: any, bindToController?: any): T; 1253 <T>(controllerName: string, locals?: any, bindToController?: any): T; 1254 } 1255 1256 interface IControllerProvider extends IServiceProvider { 1257 register(name: string, controllerConstructor: Function): void; 1258 register(name: string, dependencyAnnotatedConstructor: any[]): void; 1259 allowGlobals(): void; 1260 } 1261 1262 /** 1263 * HttpService 1264 * see http://docs.angularjs.org/api/ng/service/$http 1265 */ 1266 interface IHttpService { 1267 /** 1268 * Object describing the request to be made and how it should be processed. 1269 */ 1270 <T>(config: IRequestConfig): IHttpPromise<T>; 1271 1272 /** 1273 * Shortcut method to perform GET request. 1274 * 1275 * @param url Relative or absolute URL specifying the destination of the request 1276 * @param config Optional configuration object 1277 */ 1278 get<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>; 1279 1280 /** 1281 * Shortcut method to perform DELETE request. 1282 * 1283 * @param url Relative or absolute URL specifying the destination of the request 1284 * @param config Optional configuration object 1285 */ 1286 delete<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>; 1287 1288 /** 1289 * Shortcut method to perform HEAD request. 1290 * 1291 * @param url Relative or absolute URL specifying the destination of the request 1292 * @param config Optional configuration object 1293 */ 1294 head<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>; 1295 1296 /** 1297 * Shortcut method to perform JSONP request. 1298 * 1299 * @param url Relative or absolute URL specifying the destination of the request 1300 * @param config Optional configuration object 1301 */ 1302 jsonp<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>; 1303 1304 /** 1305 * Shortcut method to perform POST request. 1306 * 1307 * @param url Relative or absolute URL specifying the destination of the request 1308 * @param data Request content 1309 * @param config Optional configuration object 1310 */ 1311 post<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>; 1312 1313 /** 1314 * Shortcut method to perform PUT request. 1315 * 1316 * @param url Relative or absolute URL specifying the destination of the request 1317 * @param data Request content 1318 * @param config Optional configuration object 1319 */ 1320 put<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>; 1321 1322 /** 1323 * Shortcut method to perform PATCH request. 1324 * 1325 * @param url Relative or absolute URL specifying the destination of the request 1326 * @param data Request content 1327 * @param config Optional configuration object 1328 */ 1329 patch<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>; 1330 1331 /** 1332 * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations. 1333 */ 1334 defaults: IHttpProviderDefaults; 1335 1336 /** 1337 * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes. 1338 */ 1339 pendingRequests: IRequestConfig[]; 1340 } 1341 1342 /** 1343 * Object describing the request to be made and how it should be processed. 1344 * see http://docs.angularjs.org/api/ng/service/$http#usage 1345 */ 1346 interface IRequestShortcutConfig extends IHttpProviderDefaults { 1347 /** 1348 * {Object.<string|Object>} 1349 * 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. 1350 */ 1351 params?: any; 1352 1353 /** 1354 * {string|Object} 1355 * Data to be sent as the request message data. 1356 */ 1357 data?: any; 1358 1359 /** 1360 * Timeout in milliseconds, or promise that should abort the request when resolved. 1361 */ 1362 timeout?: number|IPromise<any>; 1363 1364 /** 1365 * See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype 1366 */ 1367 responseType?: string; 1368 } 1369 1370 /** 1371 * Object describing the request to be made and how it should be processed. 1372 * see http://docs.angularjs.org/api/ng/service/$http#usage 1373 */ 1374 interface IRequestConfig extends IRequestShortcutConfig { 1375 /** 1376 * HTTP method (e.g. 'GET', 'POST', etc) 1377 */ 1378 method: string; 1379 /** 1380 * Absolute or relative URL of the resource that is being requested. 1381 */ 1382 url: string; 1383 } 1384 1385 interface IHttpHeadersGetter { 1386 (): { [name: string]: string; }; 1387 (headerName: string): string; 1388 } 1389 1390 interface IHttpPromiseCallback<T> { 1391 (data: T, status: number, headers: IHttpHeadersGetter, config: IRequestConfig): void; 1392 } 1393 1394 interface IHttpPromiseCallbackArg<T> { 1395 data?: T; 1396 status?: number; 1397 headers?: IHttpHeadersGetter; 1398 config?: IRequestConfig; 1399 statusText?: string; 1400 } 1401 1402 interface IHttpPromise<T> extends IPromise<IHttpPromiseCallbackArg<T>> { 1403 success(callback: IHttpPromiseCallback<T>): IHttpPromise<T>; 1404 error(callback: IHttpPromiseCallback<any>): IHttpPromise<T>; 1405 } 1406 1407 // See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228 1408 interface IHttpRequestTransformer { 1409 (data: any, headersGetter: IHttpHeadersGetter): any; 1410 } 1411 1412 // The definition of fields are the same as IHttpPromiseCallbackArg 1413 interface IHttpResponseTransformer { 1414 (data: any, headersGetter: IHttpHeadersGetter, status: number): any; 1415 } 1416 1417 interface IHttpRequestConfigHeaders { 1418 [requestType: string]: string|(() => string); 1419 common?: string|(() => string); 1420 get?: string|(() => string); 1421 post?: string|(() => string); 1422 put?: string|(() => string); 1423 patch?: string|(() => string); 1424 } 1425 1426 /** 1427 * Object that controls the defaults for $http provider. Not all fields of IRequestShortcutConfig can be configured 1428 * via defaults and the docs do not say which. The following is based on the inspection of the source code. 1429 * https://docs.angularjs.org/api/ng/service/$http#defaults 1430 * https://docs.angularjs.org/api/ng/service/$http#usage 1431 * https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section 1432 */ 1433 interface IHttpProviderDefaults { 1434 /** 1435 * {boolean|Cache} 1436 * 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. 1437 */ 1438 cache?: any; 1439 1440 /** 1441 * Transform function or an array of such functions. The transform function takes the http request body and 1442 * headers and returns its transformed (typically serialized) version. 1443 * @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses} 1444 */ 1445 transformRequest?: IHttpRequestTransformer |IHttpRequestTransformer[]; 1446 1447 /** 1448 * Transform function or an array of such functions. The transform function takes the http response body and 1449 * headers and returns its transformed (typically deserialized) version. 1450 */ 1451 transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[]; 1452 1453 /** 1454 * Map of strings or functions which return strings representing HTTP headers to send to the server. If the 1455 * return value of a function is null, the header will not be sent. 1456 * The key of the map is the request verb in lower case. The "common" key applies to all requests. 1457 * @see {@link https://docs.angularjs.org/api/ng/service/$http#setting-http-headers} 1458 */ 1459 headers?: IHttpRequestConfigHeaders; 1460 1461 /** Name of HTTP header to populate with the XSRF token. */ 1462 xsrfHeaderName?: string; 1463 1464 /** Name of cookie containing the XSRF token. */ 1465 xsrfCookieName?: string; 1466 1467 /** 1468 * 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. 1469 */ 1470 withCredentials?: boolean; 1471 1472 /** 1473 * A function used to the prepare string representation of request parameters (specified as an object). If 1474 * specified as string, it is interpreted as a function registered with the $injector. Defaults to 1475 * $httpParamSerializer. 1476 */ 1477 paramSerializer?: string | ((obj: any) => string); 1478 } 1479 1480 interface IHttpInterceptor { 1481 request?: (config: IRequestConfig) => IRequestConfig|IPromise<IRequestConfig>; 1482 requestError?: (rejection: any) => any; 1483 response?: <T>(response: IHttpPromiseCallbackArg<T>) => IPromise<T>|T; 1484 responseError?: (rejection: any) => any; 1485 } 1486 1487 interface IHttpInterceptorFactory { 1488 (...args: any[]): IHttpInterceptor; 1489 } 1490 1491 interface IHttpProvider extends IServiceProvider { 1492 defaults: IHttpProviderDefaults; 1493 1494 /** 1495 * Register service factories (names or implementations) for interceptors which are called before and after 1496 * each request. 1497 */ 1498 interceptors: (string|IHttpInterceptorFactory|(string|IHttpInterceptorFactory)[])[]; 1499 useApplyAsync(): boolean; 1500 useApplyAsync(value: boolean): IHttpProvider; 1501 1502 /** 1503 * 1504 * @param {boolean=} value If true, `$http` will return a normal promise without the `success` and `error` methods. 1505 * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining. 1506 * otherwise, returns the current configured value. 1507 */ 1508 useLegacyPromiseExtensions(value:boolean) : boolean | IHttpProvider; 1509 } 1510 1511 /////////////////////////////////////////////////////////////////////////// 1512 // HttpBackendService 1513 // see http://docs.angularjs.org/api/ng.$httpBackend 1514 // You should never need to use this service directly. 1515 /////////////////////////////////////////////////////////////////////////// 1516 interface IHttpBackendService { 1517 // XXX Perhaps define callback signature in the future 1518 (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void; 1519 } 1520 1521 /////////////////////////////////////////////////////////////////////////// 1522 // InterpolateService 1523 // see http://docs.angularjs.org/api/ng.$interpolate 1524 // see http://docs.angularjs.org/api/ng.$interpolateProvider 1525 /////////////////////////////////////////////////////////////////////////// 1526 interface IInterpolateService { 1527 (text: string, mustHaveExpression?: boolean, trustedContext?: string, allOrNothing?: boolean): IInterpolationFunction; 1528 endSymbol(): string; 1529 startSymbol(): string; 1530 } 1531 1532 interface IInterpolationFunction { 1533 (context: any): string; 1534 } 1535 1536 interface IInterpolateProvider extends IServiceProvider { 1537 startSymbol(): string; 1538 startSymbol(value: string): IInterpolateProvider; 1539 endSymbol(): string; 1540 endSymbol(value: string): IInterpolateProvider; 1541 } 1542 1543 /////////////////////////////////////////////////////////////////////////// 1544 // TemplateCacheService 1545 // see http://docs.angularjs.org/api/ng.$templateCache 1546 /////////////////////////////////////////////////////////////////////////// 1547 interface ITemplateCacheService extends ICacheObject {} 1548 1549 /////////////////////////////////////////////////////////////////////////// 1550 // SCEService 1551 // see http://docs.angularjs.org/api/ng.$sce 1552 /////////////////////////////////////////////////////////////////////////// 1553 interface ISCEService { 1554 getTrusted(type: string, mayBeTrusted: any): any; 1555 getTrustedCss(value: any): any; 1556 getTrustedHtml(value: any): any; 1557 getTrustedJs(value: any): any; 1558 getTrustedResourceUrl(value: any): any; 1559 getTrustedUrl(value: any): any; 1560 parse(type: string, expression: string): (context: any, locals: any) => any; 1561 parseAsCss(expression: string): (context: any, locals: any) => any; 1562 parseAsHtml(expression: string): (context: any, locals: any) => any; 1563 parseAsJs(expression: string): (context: any, locals: any) => any; 1564 parseAsResourceUrl(expression: string): (context: any, locals: any) => any; 1565 parseAsUrl(expression: string): (context: any, locals: any) => any; 1566 trustAs(type: string, value: any): any; 1567 trustAsHtml(value: any): any; 1568 trustAsJs(value: any): any; 1569 trustAsResourceUrl(value: any): any; 1570 trustAsUrl(value: any): any; 1571 isEnabled(): boolean; 1572 } 1573 1574 /////////////////////////////////////////////////////////////////////////// 1575 // SCEProvider 1576 // see http://docs.angularjs.org/api/ng.$sceProvider 1577 /////////////////////////////////////////////////////////////////////////// 1578 interface ISCEProvider extends IServiceProvider { 1579 enabled(value: boolean): void; 1580 } 1581 1582 /////////////////////////////////////////////////////////////////////////// 1583 // SCEDelegateService 1584 // see http://docs.angularjs.org/api/ng.$sceDelegate 1585 /////////////////////////////////////////////////////////////////////////// 1586 interface ISCEDelegateService { 1587 getTrusted(type: string, mayBeTrusted: any): any; 1588 trustAs(type: string, value: any): any; 1589 valueOf(value: any): any; 1590 } 1591 1592 1593 /////////////////////////////////////////////////////////////////////////// 1594 // SCEDelegateProvider 1595 // see http://docs.angularjs.org/api/ng.$sceDelegateProvider 1596 /////////////////////////////////////////////////////////////////////////// 1597 interface ISCEDelegateProvider extends IServiceProvider { 1598 resourceUrlBlacklist(blacklist: any[]): void; 1599 resourceUrlWhitelist(whitelist: any[]): void; 1600 resourceUrlBlacklist(): any[]; 1601 resourceUrlWhitelist(): any[]; 1602 } 1603 1604 /** 1605 * $templateRequest service 1606 * see http://docs.angularjs.org/api/ng/service/$templateRequest 1607 */ 1608 interface ITemplateRequestService { 1609 /** 1610 * Downloads a template using $http and, upon success, stores the 1611 * contents inside of $templateCache. 1612 * 1613 * If the HTTP request fails or the response data of the HTTP request is 1614 * empty then a $compile error will be thrown (unless 1615 * {ignoreRequestError} is set to true). 1616 * 1617 * @param tpl The template URL. 1618 * @param ignoreRequestError Whether or not to ignore the exception 1619 * when the request fails or the template is 1620 * empty. 1621 * 1622 * @return A promise whose value is the template content. 1623 */ 1624 (tpl: string, ignoreRequestError?: boolean): IPromise<string>; 1625 /** 1626 * total amount of pending template requests being downloaded. 1627 * @type {number} 1628 */ 1629 totalPendingRequests: number; 1630 } 1631 1632 /////////////////////////////////////////////////////////////////////////// 1633 // Component 1634 // see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html 1635 // and http://toddmotto.com/exploring-the-angular-1-5-component-method/ 1636 /////////////////////////////////////////////////////////////////////////// 1637 /** 1638 * Runtime representation a type that a Component or other object is instances of. 1639 * 1640 * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by 1641 * the `MyCustomComponent` constructor function. 1642 */ 1643 interface Type extends Function { 1644 } 1645 1646 /** 1647 * `RouteDefinition` defines a route within a {@link RouteConfig} decorator. 1648 * 1649 * Supported keys: 1650 * - `path` or `aux` (requires exactly one of these) 1651 * - `component`, `loader`, `redirectTo` (requires exactly one of these) 1652 * - `name` or `as` (optional) (requires exactly one of these) 1653 * - `data` (optional) 1654 * 1655 * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}. 1656 */ 1657 interface RouteDefinition { 1658 path?: string; 1659 aux?: string; 1660 component?: Type | ComponentDefinition | string; 1661 loader?: Function; 1662 redirectTo?: any[]; 1663 as?: string; 1664 name?: string; 1665 data?: any; 1666 useAsDefault?: boolean; 1667 } 1668 1669 /** 1670 * Represents either a component type (`type` is `component`) or a loader function 1671 * (`type` is `loader`). 1672 * 1673 * See also {@link RouteDefinition}. 1674 */ 1675 interface ComponentDefinition { 1676 type: string; 1677 loader?: Function; 1678 component?: Type; 1679 } 1680 1681 /** 1682 * Component definition object (a simplified directive definition object) 1683 */ 1684 interface IComponentOptions { 1685 /** 1686 * Controller constructor function that should be associated with newly created scope or the name of a registered 1687 * controller if passed as a string. Empty function by default. 1688 */ 1689 controller?: string | Function; 1690 /** 1691 * An identifier name for a reference to the controller. If present, the controller will be published to scope under 1692 * the controllerAs name. If not present, this will default to be the same as the component name. 1693 */ 1694 controllerAs?: string; 1695 /** 1696 * html template as a string or a function that returns an html template as a string which should be used as the 1697 * contents of this component. Empty string by default. 1698 * If template is a function, then it is injected with the following locals: 1699 * $element - Current element 1700 * $attrs - Current attributes object for the element 1701 */ 1702 template?: string | Function; 1703 /** 1704 * path or function that returns a path to an html template that should be used as the contents of this component. 1705 * If templateUrl is a function, then it is injected with the following locals: 1706 * $element - Current element 1707 * $attrs - Current attributes object for the element 1708 */ 1709 templateUrl?: string | Function; 1710 /** 1711 * Define DOM attribute binding to component properties. Component properties are always bound to the component 1712 * controller and not to the scope. 1713 */ 1714 bindings?: any; 1715 /** 1716 * Whether transclusion is enabled. Enabled by default. 1717 */ 1718 transclude?: boolean; 1719 /** 1720 * Whether the new scope is isolated. Isolated by default. 1721 */ 1722 isolate?: boolean; 1723 /** 1724 * String of subset of EACM which restricts the component to specific directive declaration style. If omitted, 1725 * this defaults to 'E'. 1726 */ 1727 restrict?: string; 1728 $canActivate?: () => boolean; 1729 $routeConfig?: RouteDefinition[]; 1730 } 1731 1732 interface IComponentTemplateFn { 1733 ( $element?: IAugmentedJQuery, $attrs?: IAttributes ): string; 1734 } 1735 1736 /////////////////////////////////////////////////////////////////////////// 1737 // Directive 1738 // see http://docs.angularjs.org/api/ng.$compileProvider#directive 1739 // and http://docs.angularjs.org/guide/directive 1740 /////////////////////////////////////////////////////////////////////////// 1741 1742 interface IDirectiveFactory { 1743 (...args: any[]): IDirective; 1744 } 1745 1746 interface IDirectiveLinkFn { 1747 ( 1748 scope: IScope, 1749 instanceElement: IAugmentedJQuery, 1750 instanceAttributes: IAttributes, 1751 controller: {}, 1752 transclude: ITranscludeFunction 1753 ): void; 1754 } 1755 1756 interface IDirectivePrePost { 1757 pre?: IDirectiveLinkFn; 1758 post?: IDirectiveLinkFn; 1759 } 1760 1761 interface IDirectiveCompileFn { 1762 ( 1763 templateElement: IAugmentedJQuery, 1764 templateAttributes: IAttributes, 1765 transclude: ITranscludeFunction 1766 ): IDirectivePrePost; 1767 } 1768 1769 interface IDirective { 1770 compile?: IDirectiveCompileFn; 1771 controller?: any; 1772 controllerAs?: string; 1773 bindToController?: boolean|Object; 1774 link?: IDirectiveLinkFn | IDirectivePrePost; 1775 name?: string; 1776 priority?: number; 1777 replace?: boolean; 1778 require?: any; 1779 restrict?: string; 1780 scope?: any; 1781 template?: any; 1782 templateNamespace?: string; 1783 templateUrl?: any; 1784 terminal?: boolean; 1785 transclude?: any; 1786 } 1787 1788 /** 1789 * angular.element 1790 * when calling angular.element, angular returns a jQuery object, 1791 * augmented with additional methods like e.g. scope. 1792 * see: http://docs.angularjs.org/api/angular.element 1793 */ 1794 interface IAugmentedJQueryStatic extends JQueryStatic { 1795 (selector: string, context?: any): IAugmentedJQuery; 1796 (element: Element): IAugmentedJQuery; 1797 (object: {}): IAugmentedJQuery; 1798 (elementArray: Element[]): IAugmentedJQuery; 1799 (object: JQuery): IAugmentedJQuery; 1800 (func: Function): IAugmentedJQuery; 1801 (array: any[]): IAugmentedJQuery; 1802 (): IAugmentedJQuery; 1803 } 1804 1805 interface IAugmentedJQuery extends JQuery { 1806 // TODO: events, how to define? 1807 //$destroy 1808 1809 find(selector: string): IAugmentedJQuery; 1810 find(element: any): IAugmentedJQuery; 1811 find(obj: JQuery): IAugmentedJQuery; 1812 controller(): any; 1813 controller(name: string): any; 1814 injector(): any; 1815 scope(): IScope; 1816 isolateScope(): IScope; 1817 1818 inheritedData(key: string, value: any): JQuery; 1819 inheritedData(obj: { [key: string]: any; }): JQuery; 1820 inheritedData(key?: string): any; 1821 } 1822 1823 /////////////////////////////////////////////////////////////////////////// 1824 // AUTO module (angular.js) 1825 /////////////////////////////////////////////////////////////////////////// 1826 export module auto { 1827 1828 /////////////////////////////////////////////////////////////////////// 1829 // InjectorService 1830 // see http://docs.angularjs.org/api/AUTO.$injector 1831 /////////////////////////////////////////////////////////////////////// 1832 interface IInjectorService { 1833 annotate(fn: Function): string[]; 1834 annotate(inlineAnnotatedFunction: any[]): string[]; 1835 get<T>(name: string, caller?: string): T; 1836 has(name: string): boolean; 1837 instantiate<T>(typeConstructor: Function, locals?: any): T; 1838 invoke(inlineAnnotatedFunction: any[]): any; 1839 invoke(func: Function, context?: any, locals?: any): any; 1840 } 1841 1842 /////////////////////////////////////////////////////////////////////// 1843 // ProvideService 1844 // see http://docs.angularjs.org/api/AUTO.$provide 1845 /////////////////////////////////////////////////////////////////////// 1846 interface IProvideService { 1847 // Documentation says it returns the registered instance, but actual 1848 // implementation does not return anything. 1849 // constant(name: string, value: any): any; 1850 /** 1851 * 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. 1852 * 1853 * @param name The name of the constant. 1854 * @param value The constant value. 1855 */ 1856 constant(name: string, value: any): void; 1857 1858 /** 1859 * 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. 1860 * 1861 * @param name The name of the service to decorate. 1862 * @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: 1863 * 1864 * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. 1865 */ 1866 decorator(name: string, decorator: Function): void; 1867 /** 1868 * 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. 1869 * 1870 * @param name The name of the service to decorate. 1871 * @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: 1872 * 1873 * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. 1874 */ 1875 decorator(name: string, inlineAnnotatedFunction: any[]): void; 1876 factory(name: string, serviceFactoryFunction: Function): IServiceProvider; 1877 factory(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; 1878 provider(name: string, provider: IServiceProvider): IServiceProvider; 1879 provider(name: string, serviceProviderConstructor: Function): IServiceProvider; 1880 service(name: string, constructor: Function): IServiceProvider; 1881 service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; 1882 value(name: string, value: any): IServiceProvider; 1883 } 1884 1885 } 1886 }