Merge pull request #2606 from pocesar/angularjs-fix

add angular $viewChangeListeners to ngModelController
This commit is contained in:
Basarat Ali Syed
2014-08-02 17:24:12 +10:00

View File

@@ -22,7 +22,7 @@ declare module ng {
interface IServiceProviderClass {
new(...args: any[]): IServiceProvider;
}
interface IServiceProviderFactory {
(...args: any[]): IServiceProvider;
}
@@ -49,9 +49,9 @@ declare module ng {
/**
* 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.
*
*
* It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method.
*
*
* @param obj Object to iterate over.
* @param iterator Iterator function.
* @param context Object to become context (this) for the iterator function.
@@ -59,9 +59,9 @@ declare module ng {
forEach<T>(obj: T[], iterator: (value: T, key: number) => any, context?: any): any;
/**
* 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.
*
*
* It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method.
*
*
* @param obj Object to iterate over.
* @param iterator Iterator function.
* @param context Object to become context (this) for the iterator function.
@@ -69,9 +69,9 @@ declare module ng {
forEach<T>(obj: { [index: string]: T; }, iterator: (value: T, key: string) => any, context?: any): any;
/**
* 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.
*
*
* It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method.
*
*
* @param obj Object to iterate over.
* @param iterator Iterator function.
* @param context Object to become context (this) for the iterator function.
@@ -96,7 +96,7 @@ declare module ng {
* 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.
*
* 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.
*
*
* @param name The name of the module to create or retrieve.
* @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.
* @param configFn Optional configuration function for the module.
@@ -128,19 +128,19 @@ declare module ng {
animation(object: Object): IModule;
/**
* Use this method to register work which needs to be performed on module loading.
*
*
* @param configFn Execute this function on module load. Useful for service configuration.
*/
config(configFn: Function): IModule;
/**
* Use this method to register work which needs to be performed on module loading.
*
*
* @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration.
*/
config(inlineAnnotatedFunction: any[]): IModule;
/**
* 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.
*
*
* @param name The name of the constant.
* @param value The constant value.
*/
@@ -148,18 +148,18 @@ declare module ng {
constant(object: Object): IModule;
/**
* The $controller service is used by Angular to create new controllers.
*
*
* This provider allows controller registration via the register method.
*
*
* @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors.
* @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation).
*/
controller(name: string, controllerConstructor: Function): IModule;
/**
* The $controller service is used by Angular to create new controllers.
*
*
* This provider allows controller registration via the register method.
*
*
* @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors.
* @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation).
*/
@@ -170,14 +170,14 @@ declare module ng {
directive(object: Object): IModule;
/**
* 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.
*
*
* @param name The name of the instance.
* @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}).
*/
factory(name: string, $getFn: Function): IModule;
/**
* 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.
*
*
* @param name The name of the instance.
* @param inlineAnnotatedFunction The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}).
*/
@@ -291,6 +291,7 @@ declare module ng {
$parsers: IModelParser[];
$formatters: IModelFormatter[];
$viewChangeListeners: IModelViewChangeListener[];
$error: any;
$pristine: boolean;
$dirty: boolean;
@@ -306,6 +307,10 @@ declare module ng {
(value: any): any;
}
interface IModelViewChangeListener {
(): void;
}
///////////////////////////////////////////////////////////////////////////
// Scope
// see http://docs.angularjs.org/api/ng.$rootScope.Scope
@@ -574,17 +579,17 @@ declare module ng {
interface IQService {
/**
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
*
*
* Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value.
*
*
* @param promises An array or hash of promises.
*/
all(promises: IPromise<any>[]): IPromise<any[]>;
/**
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
*
*
* Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value.
*
*
* @param promises An array or hash of promises.
*/
all(promises: { [id: string]: IPromise<any>; }): IPromise<{ [id: string]: any }>;
@@ -594,27 +599,27 @@ declare module ng {
defer<T>(): IDeferred<T>;
/**
* 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.
*
*
* 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.
*
*
* @param reason Constant, message, exception or an object representing the rejection reason.
*/
reject(reason?: any): IPromise<void>;
/**
* 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.
*
*
* @param value Value or a promise
*/
when<T>(value: IPromise<T>): IPromise<T>;
/**
* 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.
*
*
* @param value Value or a promise
*/
when<T>(value: T): IPromise<T>;
/**
* 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.
*
*
* @param value Value or a promise
*/
when(): IPromise<void>;
@@ -702,7 +707,7 @@ declare module ng {
aHrefSanitizationWhitelist(): RegExp;
aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider;
imgSrcSanitizationWhitelist(): RegExp;
imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider;
}
@@ -742,7 +747,7 @@ declare module ng {
}
/**
* HttpService
* HttpService
* see http://docs.angularjs.org/api/ng/service/$http
*/
interface IHttpService {
@@ -753,7 +758,7 @@ declare module ng {
/**
* Shortcut method to perform GET request.
*
*
* @param url Relative or absolute URL specifying the destination of the request
* @param config Optional configuration object
*/
@@ -761,7 +766,7 @@ declare module ng {
/**
* Shortcut method to perform DELETE request.
*
*
* @param url Relative or absolute URL specifying the destination of the request
* @param config Optional configuration object
*/
@@ -769,7 +774,7 @@ declare module ng {
/**
* Shortcut method to perform HEAD request.
*
*
* @param url Relative or absolute URL specifying the destination of the request
* @param config Optional configuration object
*/
@@ -777,7 +782,7 @@ declare module ng {
/**
* Shortcut method to perform JSONP request.
*
*
* @param url Relative or absolute URL specifying the destination of the request
* @param config Optional configuration object
*/
@@ -785,7 +790,7 @@ declare module ng {
/**
* Shortcut method to perform POST request.
*
*
* @param url Relative or absolute URL specifying the destination of the request
* @param data Request content
* @param config Optional configuration object
@@ -794,7 +799,7 @@ declare module ng {
/**
* Shortcut method to perform PUT request.
*
*
* @param url Relative or absolute URL specifying the destination of the request
* @param data Request content
* @param config Optional configuration object
@@ -814,12 +819,12 @@ declare module ng {
/**
* Object describing the request to be made and how it should be processed.
* see http://docs.angularjs.org/api/ng/service/$http#usage
* see http://docs.angularjs.org/api/ng/service/$http#usage
*/
interface IRequestShortcutConfig {
/**
* {Object.<string|Object>}
* 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.
* 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.
*/
params?: any;
@@ -850,7 +855,7 @@ declare module ng {
withCredentials?: boolean;
/**
* {string|Object}
* {string|Object}
* Data to be sent as the request message data.
*/
data?: any;
@@ -881,7 +886,7 @@ declare module ng {
/**
* Object describing the request to be made and how it should be processed.
* see http://docs.angularjs.org/api/ng/service/$http#usage
* see http://docs.angularjs.org/api/ng/service/$http#usage
*/
interface IRequestConfig extends IRequestShortcutConfig {
/**
@@ -1114,7 +1119,7 @@ declare module ng {
annotate(fn: Function): string[];
annotate(inlineAnnotatedFunction: any[]): string[];
get(name: string): any;
has(name: string): boolean;
has(name: string): boolean;
instantiate(typeConstructor: Function, locals?: any): any;
invoke(inlineAnnotatedFunction: any[]): any;
invoke(func: Function, context?: any, locals?: any): any;
@@ -1130,7 +1135,7 @@ declare module ng {
// constant(name: string, value: any): any;
/**
* 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.
*
*
* @param name The name of the constant.
* @param value The constant value.
*/
@@ -1138,19 +1143,19 @@ declare module ng {
/**
* 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.
*
*
* @param name The name of the service to decorate.
* @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.
*/
decorator(name: string, decorator: Function): void;
/**
* 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.
*
*
* @param name The name of the service to decorate.
* @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:
*
*
* $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
*/
decorator(name: string, inlineAnnotatedFunction: any[]): void;