Merge remote-tracking branch 'upstream/master' into types2.0

This commit is contained in:
Ryan Cavanaugh
2016-04-19 15:18:41 -07:00
147 changed files with 24570 additions and 4380 deletions

View File

@@ -87,6 +87,15 @@ logCall = logService.warn;
logs = logCall.logs;
///////////////////////////////////////
// ControllerService mock
///////////////////////////////////////
var $controller: ng.IControllerService;
$controller(class TestController {}, {}, {myBinding: 'works!'});
$controller(function TestController() {}, {someLocal: 42}, {myBinding: 'works!'});
$controller('TestController', {}, {myBinding: 'works!'});
///////////////////////////////////////
// IComponentControllerService
///////////////////////////////////////

View File

@@ -97,6 +97,18 @@ declare namespace angular {
logs: string[];
}
///////////////////////////////////////////////////////////////////////////
// ControllerService mock
// see https://docs.angularjs.org/api/ngMock/service/$controller
// This interface extends http://docs.angularjs.org/api/ng.$controller
///////////////////////////////////////////////////////////////////////////
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T;
<T>(controllerConstructor: Function, locals?: any, bindings?: any): T;
<T>(controllerName: string, locals?: any, bindings?: any): T;
}
///////////////////////////////////////////////////////////////////////////
// ComponentControllerService
// see https://docs.angularjs.org/api/ngMock/service/$componentController

View File

@@ -98,9 +98,7 @@ resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () {
var promise : angular.IPromise<IMyResource>;
var arrayPromise : angular.IPromise<IMyResource[]>;
var json: {
[index: string]: any;
};
var json: IMyResource;
promise = resource.$delete();
promise = resource.$delete({ key: 'value' });

View File

@@ -153,9 +153,7 @@ declare namespace angular.resource {
/** the promise of the original server interaction that created this instance. **/
$promise : angular.IPromise<T>;
$resolved : boolean;
toJSON: () => {
[index: string]: any;
}
toJSON(): T;
}
/**

View File

@@ -204,7 +204,7 @@ declare namespace angular {
* @param name The name of the constant.
* @param value The constant value.
*/
constant(name: string, value: any): IModule;
constant<T>(name: string, value: T): IModule;
constant(object: Object): IModule;
/**
* The $controller service is used by Angular to create new controllers.
@@ -294,7 +294,7 @@ declare namespace angular {
* @param name The name of the instance.
* @param value The value.
*/
value(name: string, value: any): IModule;
value<T>(name: string, value: T): IModule;
value(object: Object): IModule;
/**