2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 // Type definitions for Angular JS 1.3+
21 // Project: http://angularjs.org
22 // Definitions by: Diego Vilar <http://github.com/diegovilar>
23 // Definitions: https://github.com/borisyankov/DefinitelyTyped
26 /// <reference path="../../../node_modules/@types/jquery/index.d.ts" />
28 declare var angular: angular.IAngularStatic;
30 // Support for painless dependency injection
35 // Collapse angular into ng
37 // Support AMD require
38 declare module 'angular' {
42 ///////////////////////////////////////////////////////////////////////////////
43 // ng module (angular.js)
44 ///////////////////////////////////////////////////////////////////////////////
45 declare module angular {
47 // not directly implemented, but ensures that constructed class implements $get
48 interface IServiceProviderClass {
49 new (...args: any[]): IServiceProvider;
52 interface IServiceProviderFactory {
53 (...args: any[]): IServiceProvider;
56 // All service providers extend this interface
57 interface IServiceProvider {
61 interface IAngularBootstrapConfig {
65 ///////////////////////////////////////////////////////////////////////////
67 // see http://docs.angularjs.org/api
68 ///////////////////////////////////////////////////////////////////////////
69 interface IAngularStatic {
70 bind(context: any, fn: Function, ...args: any[]): Function;
73 * Use this function to manually start up angular application.
75 * @param element DOM element which is the root of angular application.
76 * @param modules An array of modules to load into the application.
77 * Each item in the array should be the name of a predefined module or a (DI annotated)
78 * function that will be invoked by the injector as a run block.
79 * @param config an object for defining configuration options for the application. The following keys are supported:
80 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
82 bootstrap(element: string, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
84 * Use this function to manually start up angular application.
86 * @param element DOM element which is the root of angular application.
87 * @param modules An array of modules to load into the application.
88 * Each item in the array should be the name of a predefined module or a (DI annotated)
89 * function that will be invoked by the injector as a run block.
90 * @param config an object for defining configuration options for the application. The following keys are supported:
91 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
93 bootstrap(element: string, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
95 * Use this function to manually start up angular application.
97 * @param element DOM element which is the root of angular application.
98 * @param modules An array of modules to load into the application.
99 * Each item in the array should be the name of a predefined module or a (DI annotated)
100 * function that will be invoked by the injector as a run block.
101 * @param config an object for defining configuration options for the application. The following keys are supported:
102 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
104 bootstrap(element: string, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
106 * Use this function to manually start up angular application.
108 * @param element DOM element which is the root of angular application.
109 * @param modules An array of modules to load into the application.
110 * Each item in the array should be the name of a predefined module or a (DI annotated)
111 * function that will be invoked by the injector as a run block.
112 * @param config an object for defining configuration options for the application. The following keys are supported:
113 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
115 bootstrap(element: JQuery, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
117 * Use this function to manually start up angular application.
119 * @param element DOM element which is the root of angular application.
120 * @param modules An array of modules to load into the application.
121 * Each item in the array should be the name of a predefined module or a (DI annotated)
122 * function that will be invoked by the injector as a run block.
123 * @param config an object for defining configuration options for the application. The following keys are supported:
124 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
126 bootstrap(element: JQuery, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
128 * Use this function to manually start up angular application.
130 * @param element DOM element which is the root of angular application.
131 * @param modules An array of modules to load into the application.
132 * Each item in the array should be the name of a predefined module or a (DI annotated)
133 * function that will be invoked by the injector as a run block.
134 * @param config an object for defining configuration options for the application. The following keys are supported:
135 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
137 bootstrap(element: JQuery, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
139 * Use this function to manually start up angular application.
141 * @param element DOM element which is the root of angular application.
142 * @param modules An array of modules to load into the application.
143 * Each item in the array should be the name of a predefined module or a (DI annotated)
144 * function that will be invoked by the injector as a run block.
145 * @param config an object for defining configuration options for the application. The following keys are supported:
146 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
148 bootstrap(element: Element, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
150 * Use this function to manually start up angular application.
152 * @param element DOM element which is the root of angular application.
153 * @param modules An array of modules to load into the application.
154 * Each item in the array should be the name of a predefined module or a (DI annotated)
155 * function that will be invoked by the injector as a run block.
156 * @param config an object for defining configuration options for the application. The following keys are supported:
157 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
159 bootstrap(element: Element, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
161 * Use this function to manually start up angular application.
163 * @param element DOM element which is the root of angular application.
164 * @param modules An array of modules to load into the application.
165 * Each item in the array should be the name of a predefined module or a (DI annotated)
166 * function that will be invoked by the injector as a run block.
167 * @param config an object for defining configuration options for the application. The following keys are supported:
168 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
170 bootstrap(element: Element, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
172 * Use this function to manually start up angular application.
174 * @param element DOM element which is the root of angular application.
175 * @param modules An array of modules to load into the application.
176 * Each item in the array should be the name of a predefined module or a (DI annotated)
177 * function that will be invoked by the injector as a run block.
178 * @param config an object for defining configuration options for the application. The following keys are supported:
179 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
181 bootstrap(element: Document, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
183 * Use this function to manually start up angular application.
185 * @param element DOM element which is the root of angular application.
186 * @param modules An array of modules to load into the application.
187 * Each item in the array should be the name of a predefined module or a (DI annotated)
188 * function that will be invoked by the injector as a run block.
189 * @param config an object for defining configuration options for the application. The following keys are supported:
190 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
192 bootstrap(element: Document, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
194 * Use this function to manually start up angular application.
196 * @param element DOM element which is the root of angular application.
197 * @param modules An array of modules to load into the application.
198 * Each item in the array should be the name of a predefined module or a (DI annotated)
199 * function that will be invoked by the injector as a run block.
200 * @param config an object for defining configuration options for the application. The following keys are supported:
201 * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
203 bootstrap(element: Document, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
206 * Creates a deep copy of source, which should be an object or an array.
208 * - If no destination is supplied, a copy of the object or array is created.
209 * - 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.
210 * - If source is not an object or array (inc. null and undefined), source is returned.
211 * - If source is identical to 'destination' an exception will be thrown.
213 * @param source The source that will be used to make a copy. Can be any type, including primitives, null, and undefined.
214 * @param destination Destination into which the source is copied. If provided, must be of the same type as source.
216 copy<T>(source: T, destination?: T): T;
219 * Wraps a raw DOM element or HTML string as a jQuery element.
221 * 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."
223 element: IAugmentedJQueryStatic;
224 equals(value1: any, value2: any): boolean;
225 extend(destination: any, ...sources: any[]): any;
228 * 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.
230 * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method.
232 * @param obj Object to iterate over.
233 * @param iterator Iterator function.
234 * @param context Object to become context (this) for the iterator function.
236 forEach<T>(obj: T[], iterator: (value: T, key: number) => any, context?: any): any;
238 * 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.
240 * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method.
242 * @param obj Object to iterate over.
243 * @param iterator Iterator function.
244 * @param context Object to become context (this) for the iterator function.
246 forEach<T>(obj: { [index: string]: T; }, iterator: (value: T, key: string) => any, context?: any): any;
248 * 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.
250 * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method.
252 * @param obj Object to iterate over.
253 * @param iterator Iterator function.
254 * @param context Object to become context (this) for the iterator function.
256 forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any;
258 fromJson(json: string): any;
259 identity(arg?: any): any;
260 injector(modules?: any[]): auto.IInjectorService;
261 isArray(value: any): boolean;
262 isDate(value: any): boolean;
263 isDefined(value: any): boolean;
264 isElement(value: any): boolean;
265 isFunction(value: any): boolean;
266 isNumber(value: any): boolean;
267 isObject(value: any): boolean;
268 isString(value: any): boolean;
269 isUndefined(value: any): boolean;
270 lowercase(str: string): string;
273 * 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.
275 * 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.
277 * @param name The name of the module to create or retrieve.
278 * @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.
279 * @param configFn Optional configuration function for the module.
284 configFn?: Function): IModule;
286 noop(...args: any[]): void;
287 reloadWithDebugInfo(): void;
288 toJson(obj: any, pretty?: boolean): string;
289 uppercase(str: string): string;
299 ///////////////////////////////////////////////////////////////////////////
301 // see http://docs.angularjs.org/api/angular.Module
302 ///////////////////////////////////////////////////////////////////////////
304 animation(name: string, animationFactory: Function): IModule;
305 animation(name: string, inlineAnnotatedFunction: any[]): IModule;
306 animation(object: Object): IModule;
308 * Use this method to register work which needs to be performed on module loading.
310 * @param configFn Execute this function on module load. Useful for service configuration.
312 config(configFn: Function): IModule;
314 * Use this method to register work which needs to be performed on module loading.
316 * @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration.
318 config(inlineAnnotatedFunction: any[]): IModule;
320 * 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.
322 * @param name The name of the constant.
323 * @param value The constant value.
325 constant(name: string, value: any): IModule;
326 constant(object: Object): IModule;
328 * The $controller service is used by Angular to create new controllers.
330 * This provider allows controller registration via the register method.
332 * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors.
333 * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation).
335 controller(name: string, controllerConstructor: Function): IModule;
337 * The $controller service is used by Angular to create new controllers.
339 * This provider allows controller registration via the register method.
341 * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors.
342 * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation).
344 controller(name: string, inlineAnnotatedConstructor: any[]): IModule;
345 controller(object: Object): IModule;
347 * Register a new directive with the compiler.
349 * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
350 * @param directiveFactory An injectable directive factory function.
352 directive(name: string, directiveFactory: IDirectiveFactory): IModule;
354 * Register a new directive with the compiler.
356 * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
357 * @param directiveFactory An injectable directive factory function.
359 directive(name: string, inlineAnnotatedFunction: any[]): IModule;
360 directive(object: Object): IModule;
362 * 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.
364 * @param name The name of the instance.
365 * @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}).
367 factory(name: string, $getFn: Function): IModule;
369 * 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.
371 * @param name The name of the instance.
372 * @param inlineAnnotatedFunction The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}).
374 factory(name: string, inlineAnnotatedFunction: any[]): IModule;
375 factory(object: Object): IModule;
376 filter(name: string, filterFactoryFunction: Function): IModule;
377 filter(name: string, inlineAnnotatedFunction: any[]): IModule;
378 filter(object: Object): IModule;
379 provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule;
380 provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule;
381 provider(name: string, inlineAnnotatedConstructor: any[]): IModule;
382 provider(name: string, providerObject: IServiceProvider): IModule;
383 provider(object: Object): IModule;
385 * 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.
387 run(initializationFunction: Function): IModule;
389 * 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.
391 run(inlineAnnotatedFunction: any[]): IModule;
392 service(name: string, serviceConstructor: Function): IModule;
393 service(name: string, inlineAnnotatedConstructor: any[]): IModule;
394 service(object: Object): IModule;
396 * 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.
398 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.
400 * @param name The name of the instance.
401 * @param value The value.
403 value(name: string, value: any): IModule;
404 value(object: Object): IModule;
411 ///////////////////////////////////////////////////////////////////////////
413 // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes
414 ///////////////////////////////////////////////////////////////////////////
415 interface IAttributes {
417 * this is necessary to be able to access the scoped attributes. it's not very elegant
418 * because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way
419 * this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656
424 * Adds the CSS class value specified by the classVal parameter to the
425 * element. If animations are enabled then an animation will be triggered
426 * for the class addition.
428 $addClass(classVal: string): void;
431 * Removes the CSS class value specified by the classVal parameter from the
432 * element. If animations are enabled then an animation will be triggered for
435 $removeClass(classVal: string): void;
438 * Set DOM element attribute value.
440 $set(key: string, value: any): void;
443 * Observes an interpolated attribute.
444 * The observer function will be invoked once during the next $digest
445 * following compilation. The observer is then invoked whenever the
446 * interpolated value changes.
448 $observe(name: string, fn: (value?: any) => any): Function;
451 * A map of DOM element attribute names to the normalized name. This is needed
452 * to do reverse lookup from normalized name back to actual name.
458 * form.FormController - type in module ng
459 * see https://docs.angularjs.org/api/ng/type/form.FormController
461 interface IFormController {
464 * 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
474 $addControl(control: INgModelController): void;
475 $removeControl(control: INgModelController): void;
476 $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController): void;
478 $setPristine(): void;
479 $commitViewValue(): void;
480 $rollbackViewValue(): void;
481 $setSubmitted(): void;
482 $setUntouched(): void;
485 ///////////////////////////////////////////////////////////////////////////
487 // see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController
488 ///////////////////////////////////////////////////////////////////////////
489 interface INgModelController {
491 $setValidity(validationErrorKey: string, isValid: boolean): void;
492 // Documentation states viewValue and modelValue to be a string but other
493 // types do work and it's common to use them.
494 $setViewValue(value: any, trigger?: string): void;
495 $setPristine(): void;
498 $setUntouched(): void;
499 $rollbackViewValue(): void;
500 $commitViewValue(): void;
501 $isEmpty(value: any): boolean;
507 $parsers: IModelParser[];
508 $formatters: IModelFormatter[];
509 $viewChangeListeners: IModelViewChangeListener[];
516 $validators: IModelValidators;
517 $asyncValidators: IAsyncModelValidators;
526 interface IModelValidators {
527 [index: string]: (...args: any[]) => boolean;
530 interface IAsyncModelValidators {
531 [index: string]: (...args: any[]) => IPromise<boolean>;
534 interface IModelParser {
538 interface IModelFormatter {
542 interface IModelViewChangeListener {
547 * $rootScope - $rootScopeProvider - service in module ng
548 * see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope
550 interface IRootScopeService {
551 [index: string]: any;
554 $apply(exp: string): any;
555 $apply(exp: (scope: IScope) => any): any;
558 $applyAsync(exp: string): any;
559 $applyAsync(exp: (scope: IScope) => any): any;
561 $broadcast(name: string, ...args: any[]): IAngularEvent;
564 $emit(name: string, ...args: any[]): IAngularEvent;
567 $eval(expression: string, locals?: Object): any;
568 $eval(expression: (scope: IScope) => any, locals?: Object): any;
571 $evalAsync(expression: string): void;
572 $evalAsync(expression: (scope: IScope) => any): void;
574 // Defaults to false by the implementation checking strategy
575 $new(isolate?: boolean, parent?: IScope): IScope;
578 * Listens on events of a given type. See $emit for discussion of event life cycle.
580 * The event listener function format is: function(event, args...).
582 * @param name Event name to listen on.
583 * @param listener Function to call when the event is emitted.
585 $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function;
587 $watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function;
588 $watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function;
589 $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function;
590 $watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function;
592 $watchCollection(watchExpression: string, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
593 $watchCollection(watchExpression: (scope: IScope) => any, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
595 $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
596 $watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
599 $root: IRootScopeService;
603 $$isolateBindings: any;
607 interface IScope extends IRootScopeService { }
610 * $scope for ngRepeat directive.
611 * see https://docs.angularjs.org/api/ng/directive/ngRepeat
613 interface IRepeatScope extends IScope {
616 * iterator offset of the repeated element (0..length-1).
621 * true if the repeated element is first in the iterator.
626 * true if the repeated element is between the first and last in the iterator.
631 * true if the repeated element is last in the iterator.
636 * true if the iterator position $index is even (otherwise false).
641 * true if the iterator position $index is odd (otherwise false).
647 interface IAngularEvent {
649 * the scope on which the event was $emit-ed or $broadcast-ed.
653 * the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null.
655 currentScope: IScope;
661 * calling stopPropagation function will cancel further event propagation (available only for events that were $emit-ed).
663 stopPropagation?: Function;
665 * calling preventDefault sets defaultPrevented flag to true.
667 preventDefault: Function;
669 * true if preventDefault was called.
671 defaultPrevented: boolean;
674 ///////////////////////////////////////////////////////////////////////////
676 // see http://docs.angularjs.org/api/ng.$window
677 ///////////////////////////////////////////////////////////////////////////
678 interface IWindowService extends Window {
682 ///////////////////////////////////////////////////////////////////////////
684 // TODO undocumented, so we need to get it from the source code
685 ///////////////////////////////////////////////////////////////////////////
686 interface IBrowserService {
687 defer: angular.ITimeoutService;
691 ///////////////////////////////////////////////////////////////////////////
693 // see http://docs.angularjs.org/api/ng.$timeout
694 ///////////////////////////////////////////////////////////////////////////
695 interface ITimeoutService {
696 (func: Function, delay?: number, invokeApply?: boolean): IPromise<any>;
697 cancel(promise: IPromise<any>): boolean;
700 ///////////////////////////////////////////////////////////////////////////
702 // see http://docs.angularjs.org/api/ng.$interval
703 ///////////////////////////////////////////////////////////////////////////
704 interface IIntervalService {
705 (func: Function, delay: number, count?: number, invokeApply?: boolean): IPromise<any>;
706 cancel(promise: IPromise<any>): boolean;
709 ///////////////////////////////////////////////////////////////////////////
711 // see http://docs.angularjs.org/api/ng/provider/$animateProvider
712 ///////////////////////////////////////////////////////////////////////////
713 interface IAnimateProvider {
715 * Registers a new injectable animation factory function.
717 * @param name The name of the animation.
718 * @param factory The factory function that will be executed to return the animation object.
720 register(name: string, factory: () => IAnimateCallbackObject): void;
723 * Gets and/or sets the CSS class expression that is checked when performing an animation.
725 * @param expression The className expression which will be checked against all animations.
726 * @returns The current CSS className expression value. If null then there is no expression value.
728 classNameFilter(expression?: RegExp): RegExp;
732 * The animation object which contains callback functions for each event that is expected to be animated.
734 interface IAnimateCallbackObject {
735 eventFn(element: Node, doneFn: () => void): Function;
738 ///////////////////////////////////////////////////////////////////////////
740 // see http://docs.angularjs.org/api/ng.$filter
741 // see http://docs.angularjs.org/api/ng.$filterProvider
742 ///////////////////////////////////////////////////////////////////////////
743 interface IFilterService {
744 (name: string): Function;
747 interface IFilterProvider extends IServiceProvider {
748 register(name: string, filterFactory: Function): IServiceProvider;
751 ///////////////////////////////////////////////////////////////////////////
753 // see http://docs.angularjs.org/api/ng.$locale
754 ///////////////////////////////////////////////////////////////////////////
755 interface ILocaleService {
758 // These are not documented
759 // Check angular's i18n files for exemples
760 NUMBER_FORMATS: ILocaleNumberFormatDescriptor;
761 DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor;
762 pluralCat: (num: any) => string;
765 interface ILocaleNumberFormatDescriptor {
768 PATTERNS: ILocaleNumberPatternDescriptor[];
769 CURRENCY_SYM: string;
772 interface ILocaleNumberPatternDescriptor {
784 interface ILocaleDateTimeFormatDescriptor {
786 SHORTMONTH: string[];
800 ///////////////////////////////////////////////////////////////////////////
802 // see http://docs.angularjs.org/api/ng.$log
803 // see http://docs.angularjs.org/api/ng.$logProvider
804 ///////////////////////////////////////////////////////////////////////////
805 interface ILogService {
813 interface ILogProvider {
814 debugEnabled(): boolean;
815 debugEnabled(enabled: boolean): ILogProvider;
818 // We define this as separate interface so we can reopen it later for
819 // the ngMock module.
821 (...args: any[]): void;
824 ///////////////////////////////////////////////////////////////////////////
826 // see http://docs.angularjs.org/api/ng.$parse
827 // see http://docs.angularjs.org/api/ng.$parseProvider
828 ///////////////////////////////////////////////////////////////////////////
829 interface IParseService {
830 (expression: string): ICompiledExpression;
833 interface IParseProvider {
834 logPromiseWarnings(): boolean;
835 logPromiseWarnings(value: boolean): IParseProvider;
837 unwrapPromises(): boolean;
838 unwrapPromises(value: boolean): IParseProvider;
841 interface ICompiledExpression {
842 (context: any, locals?: any): any;
844 // If value is not provided, undefined is gonna be used since the implementation
845 // does not check the parameter. Let's force a value for consistency. If consumer
846 // whants to undefine it, pass the undefined value explicitly.
847 assign(context: any, value: any): any;
851 * $location - $locationProvider - service in module ng
852 * see https://docs.angularjs.org/api/ng/service/$location
854 interface ILocationService {
857 hash(newHash: string): ILocationService;
861 * Return path of current url
866 * Change path when called with parameter and return $location.
867 * Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing.
869 * @param path New path
871 path(path: string): ILocationService;
875 replace(): ILocationService;
878 * Return search part (as object) of current url
883 * Change search part when called with parameter and return $location.
885 * @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value.
887 * If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url.
889 search(search: any): ILocationService;
892 * Change search part when called with parameter and return $location.
894 * @param search New search params
895 * @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.
897 search(search: string, paramValue: string|number|string[]|boolean): ILocationService;
900 state(state: any): ILocationService;
902 url(url: string): ILocationService;
905 interface ILocationProvider extends IServiceProvider {
906 hashPrefix(): string;
907 hashPrefix(prefix: string): ILocationProvider;
908 html5Mode(): boolean;
910 // Documentation states that parameter is string, but
911 // implementation tests it as boolean, which makes more sense
912 // since this is a toggler
913 html5Mode(active: boolean): ILocationProvider;
914 html5Mode(mode: { enabled?: boolean; requireBase?: boolean; rewriteLinks?: boolean; }): ILocationProvider;
917 ///////////////////////////////////////////////////////////////////////////
919 // see http://docs.angularjs.org/api/ng.$document
920 ///////////////////////////////////////////////////////////////////////////
921 interface IDocumentService extends IAugmentedJQuery {}
923 ///////////////////////////////////////////////////////////////////////////
924 // ExceptionHandlerService
925 // see http://docs.angularjs.org/api/ng.$exceptionHandler
926 ///////////////////////////////////////////////////////////////////////////
927 interface IExceptionHandlerService {
928 (exception: Error, cause?: string): void;
931 ///////////////////////////////////////////////////////////////////////////
932 // RootElementService
933 // see http://docs.angularjs.org/api/ng.$rootElement
934 ///////////////////////////////////////////////////////////////////////////
935 interface IRootElementService extends JQuery {}
937 interface IQResolveReject<T> {
942 * $q - service in module ng
943 * A promise/deferred implementation inspired by Kris Kowal's Q.
944 * See http://docs.angularjs.org/api/ng/service/$q
946 interface IQService {
947 new (resolver: (resolve: IQResolveReject<any>) => any): IPromise<any>;
948 new (resolver: (resolve: IQResolveReject<any>, reject: IQResolveReject<any>) => any): IPromise<any>;
949 new <T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>;
952 * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
954 * 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.
956 * @param promises An array of promises.
958 all(promises: IPromise<any>[]): IPromise<any[]>;
960 * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
962 * 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.
964 * @param promises A hash of promises.
966 all(promises: { [id: string]: IPromise<any>; }): IPromise<{ [id: string]: any; }>;
968 * Creates a Deferred object which represents a task which will finish in the future.
970 defer<T>(): IDeferred<T>;
972 * 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.
974 * 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.
976 * @param reason Constant, message, exception or an object representing the rejection reason.
978 reject(reason?: any): IPromise<any>;
980 * 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.
982 * @param value Value or a promise
984 when<T>(value: IPromise<T>|T): IPromise<T>;
986 * 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.
988 * @param value Value or a promise
990 when(): IPromise<void>;
993 interface IPromise<T> {
995 * 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.
997 * 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.
999 then<TResult>(successCallback: (promiseValue: T) => IHttpPromise<TResult>|IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
1002 * Shorthand for promise.then(null, errorCallback)
1004 catch<TResult>(onRejected: (reason: any) => IHttpPromise<TResult>|IPromise<TResult>|TResult): IPromise<TResult>;
1007 * 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.
1009 * 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.
1011 finally<TResult>(finallyCallback: () => any): IPromise<TResult>;
1014 interface IDeferred<T> {
1015 resolve(value?: T): void;
1016 reject(reason?: any): void;
1017 notify(state?: any): void;
1018 promise: IPromise<T>;
1021 ///////////////////////////////////////////////////////////////////////////
1022 // AnchorScrollService
1023 // see http://docs.angularjs.org/api/ng.$anchorScroll
1024 ///////////////////////////////////////////////////////////////////////////
1025 interface IAnchorScrollService {
1030 interface IAnchorScrollProvider extends IServiceProvider {
1031 disableAutoScrolling(): void;
1034 ///////////////////////////////////////////////////////////////////////////
1035 // CacheFactoryService
1036 // see http://docs.angularjs.org/api/ng.$cacheFactory
1037 ///////////////////////////////////////////////////////////////////////////
1038 interface ICacheFactoryService {
1039 // Lets not foce the optionsMap to have the capacity member. Even though
1040 // it's the ONLY option considered by the implementation today, a consumer
1041 // might find it useful to associate some other options to the cache object.
1042 //(cacheId: string, optionsMap?: { capacity: number; }): CacheObject;
1043 (cacheId: string, optionsMap?: { capacity: number; }): ICacheObject;
1045 // Methods bellow are not documented
1047 get(cacheId: string): ICacheObject;
1050 interface ICacheObject {
1055 // Not garanteed to have, since it's a non-mandatory option
1058 put<T>(key: string, value?: T): T;
1059 get(key: string): any;
1060 remove(key: string): void;
1065 ///////////////////////////////////////////////////////////////////////////
1067 // see http://docs.angularjs.org/api/ng.$compile
1068 // see http://docs.angularjs.org/api/ng.$compileProvider
1069 ///////////////////////////////////////////////////////////////////////////
1070 interface ICompileService {
1071 (element: string, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction;
1072 (element: Element, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction;
1073 (element: JQuery, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction;
1076 interface ICompileProvider extends IServiceProvider {
1077 directive(name: string, directiveFactory: Function): ICompileProvider;
1079 // Undocumented, but it is there...
1080 directive(directivesMap: any): ICompileProvider;
1082 aHrefSanitizationWhitelist(): RegExp;
1083 aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider;
1085 imgSrcSanitizationWhitelist(): RegExp;
1086 imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider;
1088 debugInfoEnabled(enabled?: boolean): any;
1091 interface ICloneAttachFunction {
1092 // Let's hint but not force cloneAttachFn's signature
1093 (clonedElement?: JQuery, scope?: IScope): any;
1096 // This corresponds to the "publicLinkFn" returned by $compile.
1097 interface ITemplateLinkingFunction {
1098 (scope: IScope, cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;
1101 // This corresponds to $transclude (and also the transclude function passed to link).
1102 interface ITranscludeFunction {
1103 // If the scope is provided, then the cloneAttachFn must be as well.
1104 (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery;
1105 // If one argument is provided, then it's assumed to be the cloneAttachFn.
1106 (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery;
1109 ///////////////////////////////////////////////////////////////////////////
1110 // ControllerService
1111 // see http://docs.angularjs.org/api/ng.$controller
1112 // see http://docs.angularjs.org/api/ng.$controllerProvider
1113 ///////////////////////////////////////////////////////////////////////////
1114 interface IControllerService {
1115 // Although the documentation doesn't state this, locals are optional
1116 (controllerConstructor: Function, locals?: any): any;
1117 (controllerName: string, locals?: any): any;
1120 interface IControllerProvider extends IServiceProvider {
1121 register(name: string, controllerConstructor: Function): void;
1122 register(name: string, dependencyAnnotatedConstructor: any[]): void;
1123 allowGlobals(): void;
1128 * see http://docs.angularjs.org/api/ng/service/$http
1130 interface IHttpService {
1132 * Object describing the request to be made and how it should be processed.
1134 <T>(config: IRequestConfig): IHttpPromise<T>;
1137 * Shortcut method to perform GET request.
1139 * @param url Relative or absolute URL specifying the destination of the request
1140 * @param config Optional configuration object
1142 get<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
1145 * Shortcut method to perform DELETE request.
1147 * @param url Relative or absolute URL specifying the destination of the request
1148 * @param config Optional configuration object
1150 delete<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
1153 * Shortcut method to perform HEAD request.
1155 * @param url Relative or absolute URL specifying the destination of the request
1156 * @param config Optional configuration object
1158 head<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
1161 * Shortcut method to perform JSONP request.
1163 * @param url Relative or absolute URL specifying the destination of the request
1164 * @param config Optional configuration object
1166 jsonp<T>(url: string, config?: IRequestShortcutConfig): IHttpPromise<T>;
1169 * Shortcut method to perform POST request.
1171 * @param url Relative or absolute URL specifying the destination of the request
1172 * @param data Request content
1173 * @param config Optional configuration object
1175 post<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>;
1178 * Shortcut method to perform PUT request.
1180 * @param url Relative or absolute URL specifying the destination of the request
1181 * @param data Request content
1182 * @param config Optional configuration object
1184 put<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>;
1187 * Shortcut method to perform PATCH request.
1189 * @param url Relative or absolute URL specifying the destination of the request
1190 * @param data Request content
1191 * @param config Optional configuration object
1193 patch<T>(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise<T>;
1196 * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations.
1198 defaults: IRequestConfig;
1201 * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes.
1203 pendingRequests: any[];
1207 * Object describing the request to be made and how it should be processed.
1208 * see http://docs.angularjs.org/api/ng/service/$http#usage
1210 interface IRequestShortcutConfig {
1212 * {Object.<string|Object>}
1213 * 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.
1218 * Map of strings or functions which return strings representing HTTP headers to send to the server. If the return value of a function is null, the header will not be sent.
1223 * Name of HTTP header to populate with the XSRF token.
1225 xsrfHeaderName?: string;
1228 * Name of cookie containing the XSRF token.
1230 xsrfCookieName?: string;
1234 * 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.
1239 * 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.
1241 withCredentials?: boolean;
1245 * Data to be sent as the request message data.
1250 * {function(data, headersGetter)|Array.<function(data, headersGetter)>}
1251 * Transform function or an array of such functions. The transform function takes the http request body and headers and returns its transformed (typically serialized) version.
1253 transformRequest?: any;
1256 * {function(data, headersGetter)|Array.<function(data, headersGetter)>}
1257 * Transform function or an array of such functions. The transform function takes the http response body and headers and returns its transformed (typically deserialized) version.
1259 transformResponse?: any;
1263 * Timeout in milliseconds, or promise that should abort the request when resolved.
1270 responseType?: string;
1274 * Object describing the request to be made and how it should be processed.
1275 * see http://docs.angularjs.org/api/ng/service/$http#usage
1277 interface IRequestConfig extends IRequestShortcutConfig {
1279 * HTTP method (e.g. 'GET', 'POST', etc)
1283 * Absolute or relative URL of the resource that is being requested.
1288 interface IHttpHeadersGetter {
1289 (): { [name: string]: string; };
1290 (headerName: string): string;
1293 interface IHttpPromiseCallback<T> {
1294 (data: T, status: number, headers: IHttpHeadersGetter, config: IRequestConfig): void;
1297 interface IHttpPromiseCallbackArg<T> {
1300 headers?: IHttpHeadersGetter;
1301 config?: IRequestConfig;
1302 statusText?: string;
1305 interface IHttpPromise<T> extends IPromise<IHttpPromiseCallbackArg<T>> {
1306 success(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
1307 error(callback: IHttpPromiseCallback<any>): IHttpPromise<T>;
1311 * Object that controls the defaults for $http provider
1312 * https://docs.angularjs.org/api/ng/service/$http#defaults
1314 interface IHttpProviderDefaults {
1315 xsrfCookieName?: string;
1316 xsrfHeaderName?: string;
1317 withCredentials?: boolean;
1326 interface IHttpProvider extends IServiceProvider {
1327 defaults: IHttpProviderDefaults;
1328 interceptors: any[];
1329 useApplyAsync(): boolean;
1330 useApplyAsync(value: boolean): IHttpProvider;
1333 ///////////////////////////////////////////////////////////////////////////
1334 // HttpBackendService
1335 // see http://docs.angularjs.org/api/ng.$httpBackend
1336 // You should never need to use this service directly.
1337 ///////////////////////////////////////////////////////////////////////////
1338 interface IHttpBackendService {
1339 // XXX Perhaps define callback signature in the future
1340 (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void;
1343 ///////////////////////////////////////////////////////////////////////////
1344 // InterpolateService
1345 // see http://docs.angularjs.org/api/ng.$interpolate
1346 // see http://docs.angularjs.org/api/ng.$interpolateProvider
1347 ///////////////////////////////////////////////////////////////////////////
1348 interface IInterpolateService {
1349 (text: string, mustHaveExpression?: boolean, trustedContext?: string, allOrNothing?: boolean): IInterpolationFunction;
1350 endSymbol(): string;
1351 startSymbol(): string;
1354 interface IInterpolationFunction {
1355 (context: any): string;
1358 interface IInterpolateProvider extends IServiceProvider {
1359 startSymbol(): string;
1360 startSymbol(value: string): IInterpolateProvider;
1361 endSymbol(): string;
1362 endSymbol(value: string): IInterpolateProvider;
1365 ///////////////////////////////////////////////////////////////////////////
1366 // TemplateCacheService
1367 // see http://docs.angularjs.org/api/ng.$templateCache
1368 ///////////////////////////////////////////////////////////////////////////
1369 interface ITemplateCacheService extends ICacheObject {}
1371 ///////////////////////////////////////////////////////////////////////////
1373 // see http://docs.angularjs.org/api/ng.$sce
1374 ///////////////////////////////////////////////////////////////////////////
1375 interface ISCEService {
1376 getTrusted(type: string, mayBeTrusted: any): any;
1377 getTrustedCss(value: any): any;
1378 getTrustedHtml(value: any): any;
1379 getTrustedJs(value: any): any;
1380 getTrustedResourceUrl(value: any): any;
1381 getTrustedUrl(value: any): any;
1382 parse(type: string, expression: string): (context: any, locals: any) => any;
1383 parseAsCss(expression: string): (context: any, locals: any) => any;
1384 parseAsHtml(expression: string): (context: any, locals: any) => any;
1385 parseAsJs(expression: string): (context: any, locals: any) => any;
1386 parseAsResourceUrl(expression: string): (context: any, locals: any) => any;
1387 parseAsUrl(expression: string): (context: any, locals: any) => any;
1388 trustAs(type: string, value: any): any;
1389 trustAsHtml(value: any): any;
1390 trustAsJs(value: any): any;
1391 trustAsResourceUrl(value: any): any;
1392 trustAsUrl(value: any): any;
1393 isEnabled(): boolean;
1396 ///////////////////////////////////////////////////////////////////////////
1398 // see http://docs.angularjs.org/api/ng.$sceProvider
1399 ///////////////////////////////////////////////////////////////////////////
1400 interface ISCEProvider extends IServiceProvider {
1401 enabled(value: boolean): void;
1404 ///////////////////////////////////////////////////////////////////////////
1405 // SCEDelegateService
1406 // see http://docs.angularjs.org/api/ng.$sceDelegate
1407 ///////////////////////////////////////////////////////////////////////////
1408 interface ISCEDelegateService {
1409 getTrusted(type: string, mayBeTrusted: any): any;
1410 trustAs(type: string, value: any): any;
1411 valueOf(value: any): any;
1415 ///////////////////////////////////////////////////////////////////////////
1416 // SCEDelegateProvider
1417 // see http://docs.angularjs.org/api/ng.$sceDelegateProvider
1418 ///////////////////////////////////////////////////////////////////////////
1419 interface ISCEDelegateProvider extends IServiceProvider {
1420 resourceUrlBlacklist(blacklist: any[]): void;
1421 resourceUrlWhitelist(whitelist: any[]): void;
1425 * $templateRequest service
1426 * see http://docs.angularjs.org/api/ng/service/$templateRequest
1428 interface ITemplateRequestService {
1430 * Downloads a template using $http and, upon success, stores the
1431 * contents inside of $templateCache.
1433 * If the HTTP request fails or the response data of the HTTP request is
1434 * empty then a $compile error will be thrown (unless
1435 * {ignoreRequestError} is set to true).
1437 * @param tpl The template URL.
1438 * @param ignoreRequestError Whether or not to ignore the exception
1439 * when the request fails or the template is
1442 * @return A promise whose value is the template content.
1444 (tpl: string, ignoreRequestError?: boolean): IPromise<string>;
1446 * total amount of pending template requests being downloaded.
1449 totalPendingRequests: number;
1452 ///////////////////////////////////////////////////////////////////////////
1454 // see http://docs.angularjs.org/api/ng.$compileProvider#directive
1455 // and http://docs.angularjs.org/guide/directive
1456 ///////////////////////////////////////////////////////////////////////////
1458 interface IDirectiveFactory {
1459 (...args: any[]): IDirective;
1462 interface IDirectiveLinkFn {
1465 instanceElement: IAugmentedJQuery,
1466 instanceAttributes: IAttributes,
1468 transclude: ITranscludeFunction
1472 interface IDirectivePrePost {
1473 pre?: IDirectiveLinkFn;
1474 post?: IDirectiveLinkFn;
1477 interface IDirectiveCompileFn {
1479 templateElement: IAugmentedJQuery,
1480 templateAttributes: IAttributes,
1481 transclude: ITranscludeFunction
1482 ): IDirectivePrePost;
1485 interface IDirective {
1486 compile?: IDirectiveCompileFn;
1488 controllerAs?: string;
1489 bindToController?: boolean;
1490 link?: IDirectiveLinkFn | IDirectivePrePost;
1505 * when calling angular.element, angular returns a jQuery object,
1506 * augmented with additional methods like e.g. scope.
1507 * see: http://docs.angularjs.org/api/angular.element
1509 interface IAugmentedJQueryStatic extends JQueryStatic {
1510 (selector: string, context?: any): IAugmentedJQuery;
1511 (element: Element): IAugmentedJQuery;
1512 (object: {}): IAugmentedJQuery;
1513 (elementArray: Element[]): IAugmentedJQuery;
1514 (object: JQuery): IAugmentedJQuery;
1515 (func: Function): IAugmentedJQuery;
1516 (array: any[]): IAugmentedJQuery;
1517 (): IAugmentedJQuery;
1520 interface IAugmentedJQuery extends JQuery {
1521 // TODO: events, how to define?
1524 find(selector: string): IAugmentedJQuery;
1525 find(element: any): IAugmentedJQuery;
1526 find(obj: JQuery): IAugmentedJQuery;
1528 controller(name: string): any;
1531 isolateScope(): IScope;
1533 inheritedData(key: string, value: any): JQuery;
1534 inheritedData(obj: { [key: string]: any; }): JQuery;
1535 inheritedData(key?: string): any;
1538 ///////////////////////////////////////////////////////////////////////
1540 // see http://docs.angularjs.org/api/ng.$animate
1541 ///////////////////////////////////////////////////////////////////////
1542 interface IAnimateService {
1543 addClass(element: JQuery, className: string, done?: Function): IPromise<any>;
1544 enter(element: JQuery, parent: JQuery, after: JQuery, done?: Function): void;
1545 leave(element: JQuery, done?: Function): void;
1546 move(element: JQuery, parent: JQuery, after: JQuery, done?: Function): void;
1547 removeClass(element: JQuery, className: string, done?: Function): void;
1550 ///////////////////////////////////////////////////////////////////////////
1551 // AUTO module (angular.js)
1552 ///////////////////////////////////////////////////////////////////////////
1553 export module auto {
1555 ///////////////////////////////////////////////////////////////////////
1557 // see http://docs.angularjs.org/api/AUTO.$injector
1558 ///////////////////////////////////////////////////////////////////////
1559 interface IInjectorService {
1560 annotate(fn: Function): string[];
1561 annotate(inlineAnnotatedFunction: any[]): string[];
1562 get(name: string): any;
1563 has(name: string): boolean;
1564 instantiate(typeConstructor: Function, locals?: any): any;
1565 invoke(inlineAnnotatedFunction: any[]): any;
1566 invoke(func: Function, context?: any, locals?: any): any;
1569 ///////////////////////////////////////////////////////////////////////
1571 // see http://docs.angularjs.org/api/AUTO.$provide
1572 ///////////////////////////////////////////////////////////////////////
1573 interface IProvideService {
1574 // Documentation says it returns the registered instance, but actual
1575 // implementation does not return anything.
1576 // constant(name: string, value: any): any;
1578 * 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.
1580 * @param name The name of the constant.
1581 * @param value The constant value.
1583 constant(name: string, value: any): void;
1586 * 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.
1588 * @param name The name of the service to decorate.
1589 * @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:
1591 * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
1593 decorator(name: string, decorator: Function): void;
1595 * 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.
1597 * @param name The name of the service to decorate.
1598 * @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:
1600 * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
1602 decorator(name: string, inlineAnnotatedFunction: any[]): void;
1603 factory(name: string, serviceFactoryFunction: Function): IServiceProvider;
1604 factory(name: string, inlineAnnotatedFunction: any[]): IServiceProvider;
1605 provider(name: string, provider: IServiceProvider): IServiceProvider;
1606 provider(name: string, serviceProviderConstructor: Function): IServiceProvider;
1607 service(name: string, constructor: Function): IServiceProvider;
1608 value(name: string, value: any): IServiceProvider;