Merge pull request #971 from zauberpony/angular.element

improve anguar.element() type information
This commit is contained in:
Diullei Gomes
2013-09-02 13:08:09 -07:00
2 changed files with 41 additions and 2 deletions
+8 -1
View File
@@ -149,7 +149,7 @@ module HttpAndRegularPromiseTests {
}
}
// Test for AngularJS Syntac
// Test for AngularJS Syntax
module My.Namespace {
export var x; // need to export something for module to kick in
@@ -210,3 +210,10 @@ foo.then((x) => {
// x is infered to be a number, which is the resolved value of a promise
x.toFixed();
});
// angular.element() tests
var element = angular.element("div.myApp");
var scope: ng.IScope = element.scope();
Vendored Regular → Executable
+33 -1
View File
@@ -33,7 +33,7 @@ declare module ng {
bootstrap(element: JQuery, modules?: any[]): auto.IInjectorService;
bootstrap(element: Element, modules?: any[]): auto.IInjectorService;
copy(source: any, destination?: any): any;
element: JQueryStatic;
element: IAugmentedJQueryStatic;
equals(value1: any, value2: any): boolean;
extend(destination: any, ...sources: any[]): any;
forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any;
@@ -669,6 +669,38 @@ declare module ng {
compile?: Function;
}
///////////////////////////////////////////////////////////////////////////
// angular.element
// when calling angular.element, angular returns a jQuery object,
// augmented with additional methods like e.g. scope.
// see: http://docs.angularjs.org/api/angular.element
///////////////////////////////////////////////////////////////////////////
interface IAugmentedJQueryStatic extends JQueryStatic {
(selector: string, context?: any): IAugmentedJQuery;
(element: Element): IAugmentedJQuery;
(object: {}): IAugmentedJQuery;
(elementArray: Element[]): IAugmentedJQuery;
(object: JQuery): IAugmentedJQuery;
(func: Function): IAugmentedJQuery;
(array: any[]): IAugmentedJQuery;
(): IAugmentedJQuery;
}
interface IAugmentedJQuery extends JQuery {
// TODO: events, how to define?
//$destroy
controller(name: string): any;
injector(): any;
scope(): IScope;
inheritedData(key: string, value: any): JQuery;
inheritedData(obj: { [key: string]: any; }): JQuery;
inheritedData(key?: string): any;
}
///////////////////////////////////////////////////////////////////////////
// AUTO module (angular.js)