mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
AngularJS: add initial support for component router
This commit is contained in:
106
angularjs/angular.d.ts
vendored
106
angularjs/angular.d.ts
vendored
@@ -165,7 +165,7 @@ declare module angular {
|
||||
dot: number;
|
||||
codeName: string;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called.
|
||||
* @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with.
|
||||
@@ -1626,22 +1626,106 @@ declare module angular {
|
||||
*/
|
||||
totalPendingRequests: number;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Component
|
||||
// see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html
|
||||
// and http://toddmotto.com/exploring-the-angular-1-5-component-method/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Runtime representation a type that a Component or other object is instances of.
|
||||
*
|
||||
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
||||
* the `MyCustomComponent` constructor function.
|
||||
*/
|
||||
interface Type extends Function {
|
||||
}
|
||||
|
||||
/**
|
||||
* `RouteDefinition` defines a route within a {@link RouteConfig} decorator.
|
||||
*
|
||||
* Supported keys:
|
||||
* - `path` or `aux` (requires exactly one of these)
|
||||
* - `component`, `loader`, `redirectTo` (requires exactly one of these)
|
||||
* - `name` or `as` (optional) (requires exactly one of these)
|
||||
* - `data` (optional)
|
||||
*
|
||||
* See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}.
|
||||
*/
|
||||
interface RouteDefinition {
|
||||
path?: string;
|
||||
aux?: string;
|
||||
component?: Type | ComponentDefinition | string;
|
||||
loader?: Function;
|
||||
redirectTo?: any[];
|
||||
as?: string;
|
||||
name?: string;
|
||||
data?: any;
|
||||
useAsDefault?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents either a component type (`type` is `component`) or a loader function
|
||||
* (`type` is `loader`).
|
||||
*
|
||||
* See also {@link RouteDefinition}.
|
||||
*/
|
||||
interface ComponentDefinition {
|
||||
type: string;
|
||||
loader?: Function;
|
||||
component?: Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component definition object (a simplified directive definition object)
|
||||
*/
|
||||
interface IComponentOptions {
|
||||
bindings?: Object,
|
||||
controller: Function|string,
|
||||
controllerAs?: string,
|
||||
isolate?: boolean,
|
||||
restrict?: string,
|
||||
template?: Array<string>|Function,
|
||||
templateUrl?: string,
|
||||
transclude?: boolean
|
||||
/**
|
||||
* Controller constructor function that should be associated with newly created scope or the name of a registered
|
||||
* controller if passed as a string. Empty function by default.
|
||||
*/
|
||||
controller?: string | Function;
|
||||
/**
|
||||
* An identifier name for a reference to the controller. If present, the controller will be published to scope under
|
||||
* the controllerAs name. If not present, this will default to be the same as the component name.
|
||||
*/
|
||||
controllerAs?: string;
|
||||
/**
|
||||
* html template as a string or a function that returns an html template as a string which should be used as the
|
||||
* contents of this component. Empty string by default.
|
||||
* If template is a function, then it is injected with the following locals:
|
||||
* $element - Current element
|
||||
* $attrs - Current attributes object for the element
|
||||
*/
|
||||
template?: string | Function;
|
||||
/**
|
||||
* path or function that returns a path to an html template that should be used as the contents of this component.
|
||||
* If templateUrl is a function, then it is injected with the following locals:
|
||||
* $element - Current element
|
||||
* $attrs - Current attributes object for the element
|
||||
*/
|
||||
templateUrl?: string | Function;
|
||||
/**
|
||||
* Define DOM attribute binding to component properties. Component properties are always bound to the component
|
||||
* controller and not to the scope.
|
||||
*/
|
||||
bindings?: any;
|
||||
/**
|
||||
* Whether transclusion is enabled. Enabled by default.
|
||||
*/
|
||||
transclude?: boolean;
|
||||
/**
|
||||
* Whether the new scope is isolated. Isolated by default.
|
||||
*/
|
||||
isolate?: boolean;
|
||||
/**
|
||||
* String of subset of EACM which restricts the component to specific directive declaration style. If omitted,
|
||||
* this defaults to 'E'.
|
||||
*/
|
||||
restrict?: string;
|
||||
$canActivate?: () => boolean;
|
||||
$routeConfig?: RouteDefinition[];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user