Merge pull request #3124 from pocesar/angular-update

update angular to released version 1.3+
This commit is contained in:
Basarat Ali Syed
2014-11-13 10:42:04 +11:00
4 changed files with 146 additions and 34 deletions
+2
View File
@@ -33,3 +33,5 @@ _infrastructure/tests/build
!rx.js
node_modules
.sublimets
+3 -1
View File
@@ -15,7 +15,9 @@ declare module ng.cookies {
// CookieService
// see http://docs.angularjs.org/api/ngCookies.$cookies
///////////////////////////////////////////////////////////////////////////
interface ICookiesService {}
interface ICookiesService {
[index: string]: any;
}
///////////////////////////////////////////////////////////////////////////
// CookieStoreService
+42 -1
View File
@@ -83,7 +83,7 @@ angular.module('http-auth-interceptor', [])
}
}];
$httpProvider.responseInterceptors.push(interceptor);
$httpProvider.interceptors.push(interceptor);
}]);
@@ -326,6 +326,47 @@ class SampleDirective2 implements ng.IDirective {
angular.module('SameplDirective', []).directive('sampleDirective', SampleDirective.instance).directive('sameplDirective2', SampleDirective2.instance);
angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpolate', '$q', ($interpolate: ng.IInterpolateService, $q: ng.IQService) => {
return {
restrict: 'A',
link: (scope: ng.IScope, el: ng.IAugmentedJQuery, attr: ng.IAttributes) => {
$interpolate(attr['test'])(scope);
$interpolate('', true)(scope);
$interpolate('', true, 'html')(scope);
$interpolate('', true, 'html', true)(scope);
var defer = $q.defer();
defer.reject();
defer.resolve();
defer.promise.then(function(d) {
return d;
}).then(function(): any {
return null;
}, function(): any {
return null;
})
.catch((): any => {
return null;
})
.finally((): any => {
return null;
});
var promise = new $q((resolve) => {
resolve();
});
promise = new $q((resolve, reject) => {
reject();
resolve(true);
});
promise = new $q<boolean>((resolver, reject) => {
resolver(true);
reject(false);
});
}
};
}]);
// test from https://docs.angularjs.org/guide/directive
angular.module('docsSimpleDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
+99 -32
View File
@@ -13,6 +13,11 @@ interface Function {
$inject?: string[];
}
// Support AMD require
declare module 'angular' {
export = angular;
}
///////////////////////////////////////////////////////////////////////////////
// ng module (angular.js)
///////////////////////////////////////////////////////////////////////////////
@@ -32,6 +37,10 @@ declare module ng {
$get: any;
}
interface IAngularBootstrapConfig {
strictDi?: boolean;
}
///////////////////////////////////////////////////////////////////////////
// AngularStatic
// see http://docs.angularjs.org/api
@@ -46,8 +55,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: string, modules?: string): auto.IInjectorService;
bootstrap(element: string, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -55,8 +66,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: string, modules?: Function): auto.IInjectorService;
bootstrap(element: string, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -64,8 +77,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: string, modules?: string[]): auto.IInjectorService;
bootstrap(element: string, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -73,8 +88,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: JQuery, modules?: string): auto.IInjectorService;
bootstrap(element: JQuery, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -82,8 +99,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: JQuery, modules?: Function): auto.IInjectorService;
bootstrap(element: JQuery, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -91,8 +110,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: JQuery, modules?: string[]): auto.IInjectorService;
bootstrap(element: JQuery, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -100,8 +121,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: Element, modules?: string): auto.IInjectorService;
bootstrap(element: Element, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -109,8 +132,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: Element, modules?: Function): auto.IInjectorService;
bootstrap(element: Element, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -118,8 +143,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: Element, modules?: string[]): auto.IInjectorService;
bootstrap(element: Element, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -127,8 +154,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: Document, modules?: string): auto.IInjectorService;
bootstrap(element: Document, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -136,8 +165,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: Document, modules?: Function): auto.IInjectorService;
bootstrap(element: Document, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Use this function to manually start up angular application.
*
@@ -145,8 +176,10 @@ declare module ng {
* @param modules An array of modules to load into the application.
* Each item in the array should be the name of a predefined module or a (DI annotated)
* function that will be invoked by the injector as a run block.
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: Document, modules?: string[]): auto.IInjectorService;
bootstrap(element: Document, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Creates a deep copy of source, which should be an object or an array.
@@ -230,6 +263,7 @@ declare module ng {
configFn?: Function): IModule;
noop(...args: any[]): void;
reloadWithDebugInfo(): void;
toJson(obj: any, pretty?: boolean): string;
uppercase(str: string): string;
version: {
@@ -412,6 +446,7 @@ declare module ng {
$commitViewValue(): void;
$rollbackViewValue(): void;
$setSubmitted(): void;
$setUntouched(): void;
}
///////////////////////////////////////////////////////////////////////////
@@ -423,13 +458,13 @@ declare module ng {
$setValidity(validationErrorKey: string, isValid: boolean): void;
// Documentation states viewValue and modelValue to be a string but other
// types do work and it's common to use them.
$setViewValue(value: any): void;
$setViewValue(value: any, trigger?: string): void;
$setPristine(): void;
$validate(): void;
$setTouched(): void;
$setUntouched(): void;
$rollbackViewValue(): void;
$commitViewValue(revalidate?: boolean): void;
$commitViewValue(): void;
$isEmpty(value: any): boolean;
$viewValue: any;
@@ -448,6 +483,7 @@ declare module ng {
$validators: IModelValidators;
$asyncValidators: IAsyncModelValidators;
$pending: any;
$pristine: boolean;
$dirty: boolean;
$valid: boolean;
@@ -479,10 +515,13 @@ declare module ng {
* see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope
*/
interface IRootScopeService {
[index: string]: any;
$apply(): any;
$apply(exp: string): any;
$apply(exp: (scope: IScope) => any): any;
$applyAsync(): any;
$applyAsync(exp: string): any;
$applyAsync(exp: (scope: IScope) => any): any;
@@ -491,14 +530,16 @@ declare module ng {
$digest(): void;
$emit(name: string, ...args: any[]): IAngularEvent;
$eval(expression?: string, args?: Object): any;
$eval(expression?: (scope: IScope) => any, args?: Object): any;
$eval(): any;
$eval(expression: string, locals?: Object): any;
$eval(expression: (scope: IScope) => any, locals?: Object): any;
$evalAsync(expression?: string): void;
$evalAsync(expression?: (scope: IScope) => any): void;
$evalAsync(): void;
$evalAsync(expression: string): void;
$evalAsync(expression: (scope: IScope) => any): void;
// Defaults to false by the implementation checking strategy
$new(isolate?: boolean): IScope;
$new(isolate?: boolean, parent?: IScope): IScope;
/**
* Listens on events of a given type. See $emit for discussion of event life cycle.
@@ -522,10 +563,7 @@ declare module ng {
$watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
$parent: IScope;
$root: IRootScopeService;
this: IRootScopeService;
$id: number;
// Hidden members
@@ -533,9 +571,7 @@ declare module ng {
$$phase: any;
}
interface IScope extends IRootScopeService {
[index: string]: any;
}
interface IScope extends IRootScopeService { }
interface IAngularEvent {
/**
@@ -703,8 +739,8 @@ declare module ng {
}
interface ILogProvider {
debugEnabled(enabled: boolean): ILogProvider;
debugEnabled(): boolean;
debugEnabled(enabled: boolean): ILogProvider;
}
// We define this as separete interface so we can reopen it later for
@@ -812,6 +848,8 @@ declare module ng {
*/
search(search: string, paramValue: boolean): ILocationService;
state(): any;
state(state: any): ILocationService;
url(): string;
url(url: string): ILocationService;
}
@@ -847,12 +885,20 @@ declare module ng {
///////////////////////////////////////////////////////////////////////////
interface IRootElementService extends JQuery {}
interface IQResolveReject<T> {
(): void;
(value: T): void;
}
/**
* $q - service in module ng
* A promise/deferred implementation inspired by Kris Kowal's Q.
* See http://docs.angularjs.org/api/ng/service/$q
*/
interface IQService {
new (resolver: (resolve: IQResolveReject<any>) => any): IPromise<any>;
new (resolver: (resolve: IQResolveReject<any>, reject: IQResolveReject<any>) => any): IPromise<any>;
new <T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>;
/**
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
*
@@ -955,6 +1001,7 @@ declare module ng {
///////////////////////////////////////////////////////////////////////////
interface IAnchorScrollService {
(): void;
yOffset: any;
}
interface IAnchorScrollProvider extends IServiceProvider {
@@ -1014,6 +1061,8 @@ declare module ng {
imgSrcSanitizationWhitelist(): RegExp;
imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider;
debugInfoEnabled(enabled?: boolean): any;
}
interface ICloneAttachFunction {
@@ -1048,6 +1097,7 @@ declare module ng {
interface IControllerProvider extends IServiceProvider {
register(name: string, controllerConstructor: Function): void;
register(name: string, dependencyAnnotatedConstructor: any[]): void;
allowGlobals(): void;
}
/**
@@ -1227,10 +1277,22 @@ declare module ng {
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg<any>) => any): IPromise<TResult>;
}
interface IHttpProviderDefaults {
xsrfCookieName?: string;
xsrfHeaderName?: string;
headers?: {
common?: any;
post?: any;
put?: any;
patch?: any;
}
}
interface IHttpProvider extends IServiceProvider {
defaults: IRequestConfig;
defaults: IHttpProviderDefaults;
interceptors: any[];
responseInterceptors: any[];
useApplyAsync(): boolean;
useApplyAsync(value: boolean): IHttpProvider;
}
///////////////////////////////////////////////////////////////////////////
@@ -1249,7 +1311,7 @@ declare module ng {
// see http://docs.angularjs.org/api/ng.$interpolateProvider
///////////////////////////////////////////////////////////////////////////
interface IInterpolateService {
(text: string, mustHaveExpression?: boolean): IInterpolationFunction;
(text: string, mustHaveExpression?: boolean, trustedContext?: string, allOrNothing?: boolean): IInterpolationFunction;
endSymbol(): string;
startSymbol(): string;
}
@@ -1345,6 +1407,11 @@ declare module ng {
* @return A promise whose value is the template content.
*/
(tpl: string, ignoreRequestError?: boolean): IPromise<string>;
/**
* total amount of pending template requests being downloaded.
* @type {number}
*/
totalPendingRequests: number;
}
///////////////////////////////////////////////////////////////////////////
@@ -1364,7 +1431,7 @@ declare module ng {
instanceAttributes: IAttributes,
controller: any,
transclude: ITranscludeFunction
): void;
): void;
}
interface IDirectivePrePost {
@@ -1377,7 +1444,7 @@ declare module ng {
templateElement: IAugmentedJQuery,
templateAttributes: IAttributes,
transclude: ITranscludeFunction
): IDirectivePrePost;
): IDirectivePrePost;
}
interface IDirective {