parent
64ad74acbe
commit
5c25248582
2
modules/angular2/di_annotations.js
vendored
2
modules/angular2/di_annotations.js
vendored
@ -2,6 +2,6 @@
|
|||||||
* @module
|
* @module
|
||||||
* @public
|
* @public
|
||||||
* @description
|
* @description
|
||||||
* Annotations which controll how the dependencies are resolved by the [Injector].
|
* Annotations which control how the dependencies are resolved by the {@link Injector}.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
2
modules/angular2/di_errors.js
vendored
2
modules/angular2/di_errors.js
vendored
@ -2,6 +2,6 @@
|
|||||||
* @module
|
* @module
|
||||||
* @public
|
* @public
|
||||||
* @description
|
* @description
|
||||||
* Errors thrown by the [Injector].
|
* Errors thrown by the {@link Injector}.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
6
modules/angular2/forms.js
vendored
6
modules/angular2/forms.js
vendored
@ -2,9 +2,9 @@
|
|||||||
* @module
|
* @module
|
||||||
* @public
|
* @public
|
||||||
* @description
|
* @description
|
||||||
* This module is used for handling user input, by defining and building a [FormObject] that consists of [Control]
|
* This module is used for handling user input, by defining and building a {@link ControlGroup} that consists of
|
||||||
* objects, and mapping them onto the DOM. [Control] objects can then be used to read information from the form DOM
|
* {@link Control} objects, and mapping them onto the DOM. {@link Control} objects can then be used to read information
|
||||||
* elements.
|
* from the form DOM elements.
|
||||||
*
|
*
|
||||||
* This module is not included in the `angular2` module; you must import the forms module explicitly.
|
* This module is not included in the `angular2` module; you must import the forms module explicitly.
|
||||||
*
|
*
|
||||||
|
@ -32,6 +32,7 @@ export var defaultPipes = {
|
|||||||
"keyValDiff" : keyValDiff
|
"keyValDiff" : keyValDiff
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @exportedAs angular2/change_detection
|
* @exportedAs angular2/change_detection
|
||||||
*/
|
*/
|
||||||
@ -66,4 +67,4 @@ export class JitChangeDetection extends ChangeDetection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export var defaultPipeRegistry = new PipeRegistry(defaultPipes);
|
export var defaultPipeRegistry = new PipeRegistry(defaultPipes);
|
||||||
|
@ -4,7 +4,7 @@ import {CHECK_ONCE, DETACHED, CHECK_ALWAYS} from './constants';
|
|||||||
/**
|
/**
|
||||||
* Controls change detection.
|
* Controls change detection.
|
||||||
*
|
*
|
||||||
* [ChangeDetectorRef] allows requesting checks for detectors that rely on observables. It also allows detaching and
|
* {@link ChangeDetectorRef} allows requesting checks for detectors that rely on observables. It also allows detaching and
|
||||||
* attaching change detector subtrees.
|
* attaching change detector subtrees.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/change_detection
|
* @exportedAs angular2/change_detection
|
||||||
@ -42,4 +42,4 @@ export class ChangeDetectorRef {
|
|||||||
this._cd.mode = CHECK_ALWAYS;
|
this._cd.mode = CHECK_ALWAYS;
|
||||||
this.requestCheck();
|
this.requestCheck();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,17 +14,17 @@ export class ProtoChangeDetector {
|
|||||||
*
|
*
|
||||||
* Angular implements the following change detection strategies by default:
|
* Angular implements the following change detection strategies by default:
|
||||||
*
|
*
|
||||||
* - [dynamicChangeDetection]: slower, but does not require `eval()`.
|
* - {@link DynamicChangeDetection}: slower, but does not require `eval()`.
|
||||||
* - [jitChangeDetection]: faster, but requires `eval()`.
|
* - {@link JitChangeDetection}: faster, but requires `eval()`.
|
||||||
*
|
*
|
||||||
* In JavaScript, you should always use `jitChangeDetection`, unless you are in an environment that has
|
* In JavaScript, you should always use `JitChangeDetection`, unless you are in an environment that has
|
||||||
* [CSP](https://developer.mozilla.org/en-US/docs/Web/Security/CSP), such as a Chrome Extension.
|
* [CSP](https://developer.mozilla.org/en-US/docs/Web/Security/CSP), such as a Chrome Extension.
|
||||||
*
|
*
|
||||||
* In Dart, use `dynamicChangeDetection` during development. The Angular transformer generates an analog to the
|
* In Dart, use `DynamicChangeDetection` during development. The Angular transformer generates an analog to the
|
||||||
* `jitChangeDetection` strategy at compile time.
|
* `JitChangeDetection` strategy at compile time.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* See: [dynamicChangeDetection], [jitChangeDetection]
|
* See: {@link DynamicChangeDetection}, {@link JitChangeDetection}
|
||||||
*
|
*
|
||||||
* # Example
|
* # Example
|
||||||
* ```javascript
|
* ```javascript
|
||||||
|
@ -210,10 +210,10 @@ export class IterableChanges extends Pipe {
|
|||||||
/**
|
/**
|
||||||
* This is the core function which handles differences between collections.
|
* This is the core function which handles differences between collections.
|
||||||
*
|
*
|
||||||
* - [record] is the record which we saw at this position last time. If null then it is a new
|
* - `record` is the record which we saw at this position last time. If null then it is a new
|
||||||
* item.
|
* item.
|
||||||
* - [item] is the current item in the collection
|
* - `item` is the current item in the collection
|
||||||
* - [index] is the position of the item in the collection
|
* - `index` is the position of the item in the collection
|
||||||
*/
|
*/
|
||||||
_mismatch(record:CollectionChangeRecord, item, index:int):CollectionChangeRecord {
|
_mismatch(record:CollectionChangeRecord, item, index:int):CollectionChangeRecord {
|
||||||
// The previous record after which we will append the current one.
|
// The previous record after which we will append the current one.
|
||||||
@ -284,9 +284,9 @@ export class IterableChanges extends Pipe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get rid of any excess [CollectionChangeRecord]s from the previous collection
|
* Get rid of any excess {@link CollectionChangeRecord}s from the previous collection
|
||||||
*
|
*
|
||||||
* - [record] The first excess [CollectionChangeRecord].
|
* - `record` The first excess {@link CollectionChangeRecord}.
|
||||||
*/
|
*/
|
||||||
_truncate(record:CollectionChangeRecord) {
|
_truncate(record:CollectionChangeRecord) {
|
||||||
// Anything after that needs to be removed;
|
// Anything after that needs to be removed;
|
||||||
@ -588,7 +588,7 @@ class _DuplicateItemRecordList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove one [CollectionChangeRecord] from the list of duplicates.
|
* Remove one {@link CollectionChangeRecord} from the list of duplicates.
|
||||||
*
|
*
|
||||||
* Returns whether the list of duplicates is empty.
|
* Returns whether the list of duplicates is empty.
|
||||||
*/
|
*/
|
||||||
@ -651,7 +651,7 @@ class _DuplicateMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an [CollectionChangeRecord] from the list of duplicates.
|
* Removes a {@link CollectionChangeRecord} from the list of duplicates.
|
||||||
*
|
*
|
||||||
* The list of duplicates also is removed from the map if it gets empty.
|
* The list of duplicates also is removed from the map if it gets empty.
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Indicates that the result of a [Pipe] transformation has not changed since the last time the pipe was called.
|
* Indicates that the result of a {@link Pipe} transformation has not changed since the last time the pipe was called.
|
||||||
*
|
*
|
||||||
* Suppose we have a pipe that computes changes in an array by performing a simple diff operation. If
|
* Suppose we have a pipe that computes changes in an array by performing a simple diff operation. If
|
||||||
* we call this pipe with the same array twice, it will return `NO_CHANGE` the second time.
|
* we call this pipe with the same array twice, it will return `NO_CHANGE` the second time.
|
||||||
@ -12,7 +12,7 @@ export var NO_CHANGE = new Object();
|
|||||||
/**
|
/**
|
||||||
* An interface for extending the list of pipes known to Angular.
|
* An interface for extending the list of pipes known to Angular.
|
||||||
*
|
*
|
||||||
* If you are writing a custom [Pipe], you must extend this interface.
|
* If you are writing a custom {@link Pipe}, you must extend this interface.
|
||||||
*
|
*
|
||||||
* #Example
|
* #Example
|
||||||
*
|
*
|
||||||
|
@ -8,32 +8,32 @@ import {DEFAULT} from 'angular2/change_detection';
|
|||||||
/**
|
/**
|
||||||
* Directives allow you to attach behavior to elements in the DOM.
|
* Directives allow you to attach behavior to elements in the DOM.
|
||||||
*
|
*
|
||||||
* Directive is an abstract concept, instead use concrete directives: [Component], [DynamicComponent], [Decorator]
|
* Directive is an abstract concept, instead use concrete directives: {@link Component}, {@link DynamicComponent}, {@link Decorator}
|
||||||
* or [Viewport].
|
* or {@link Viewport}.
|
||||||
*
|
*
|
||||||
* A directive consists of a single directive annotation and a controller class. When the directive's [selector] matches
|
* A directive consists of a single directive annotation and a controller class. When the directive's `selector` matches
|
||||||
* elements in the DOM, the following steps occur:
|
* elements in the DOM, the following steps occur:
|
||||||
*
|
*
|
||||||
* 1. For each directive, the [ElementInjector] attempts to resolve the directive's constructor arguments.
|
* 1. For each directive, the `ElementInjector` attempts to resolve the directive's constructor arguments.
|
||||||
* 2. Angular instantiates directives for each matched element using [ElementInjector] in a depth-first order,
|
* 2. Angular instantiates directives for each matched element using `ElementInjector` in a depth-first order,
|
||||||
* as declared in the HTML.
|
* as declared in the HTML.
|
||||||
*
|
*
|
||||||
* ## Understanding How Injection Works
|
* ## Understanding How Injection Works
|
||||||
*
|
*
|
||||||
* There are three stages of injection resolution.
|
* There are three stages of injection resolution.
|
||||||
* - *Pre-existing Injectors*:
|
* - *Pre-existing Injectors*:
|
||||||
* - The terminal [Injector] cannot resolve dependencies. It either throws an error or, if the dependency was
|
* - The terminal {@link Injector} cannot resolve dependencies. It either throws an error or, if the dependency was
|
||||||
* specified as `@Optional`, returns `null`.
|
* specified as `@Optional`, returns `null`.
|
||||||
* - The platform injector resolves browser singleton resources, such as: cookies, title, location, and others.
|
* - The platform injector resolves browser singleton resources, such as: cookies, title, location, and others.
|
||||||
* - *Component Injectors*: Each `@Component` has its own [Injector], and they follow the same parent-child hierarchy
|
* - *Component Injectors*: Each `@Component` has its own {@link Injector}, and they follow the same parent-child hierarchy
|
||||||
* as the components in the DOM.
|
* as the components in the DOM.
|
||||||
* - *Element Injectors*: Each component has a Shadow DOM. Within the Shadow DOM each element has an [ElementInjector]
|
* - *Element Injectors*: Each component has a Shadow DOM. Within the Shadow DOM each element has an `ElementInjector`
|
||||||
* which follow the same parent-child hierarchy as the DOM elements themselves.
|
* which follow the same parent-child hierarchy as the DOM elements themselves.
|
||||||
*
|
*
|
||||||
* When a template is instantiated, it also must instantiate the corresponding directives in a depth-first order. The
|
* When a template is instantiated, it also must instantiate the corresponding directives in a depth-first order. The
|
||||||
* current [ElementInjector] resolves the constructor dependencies for each directive.
|
* current `ElementInjector` resolves the constructor dependencies for each directive.
|
||||||
*
|
*
|
||||||
* Angular then resolves dependencies as follows, according to the order in which they appear in the [View]:
|
* Angular then resolves dependencies as follows, according to the order in which they appear in the {@link View}:
|
||||||
*
|
*
|
||||||
* 1. Dependencies on the current element
|
* 1. Dependencies on the current element
|
||||||
* 2. Dependencies on element injectors and their parents until it encounters a Shadow DOM boundary
|
* 2. Dependencies on element injectors and their parents until it encounters a Shadow DOM boundary
|
||||||
@ -41,21 +41,21 @@ import {DEFAULT} from 'angular2/change_detection';
|
|||||||
* 4. Dependencies on pre-existing injectors
|
* 4. Dependencies on pre-existing injectors
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* The [ElementInjector] can inject other directives, element-specific special objects, or it can delegate to the parent
|
* The `ElementInjector` can inject other directives, element-specific special objects, or it can delegate to the parent
|
||||||
* injector.
|
* injector.
|
||||||
*
|
*
|
||||||
* To inject other directives, declare the constructor parameter as:
|
* To inject other directives, declare the constructor parameter as:
|
||||||
* - `directive:DirectiveType`: a directive on the current element only
|
* - `directive:DirectiveType`: a directive on the current element only
|
||||||
* - `@Ancestor() directive:DirectiveType`: any directive that matches the type between the current element and the
|
* - `@Ancestor() directive:DirectiveType`: any directive that matches the type between the current element and the
|
||||||
* Shadow DOM root. Current element is not included in the resolution, therefor even if it could resolve it, it will
|
* Shadow DOM root. Current element is not included in the resolution, therefore even if it could resolve it, it will
|
||||||
* be ignored.
|
* be ignored.
|
||||||
* - `@Parent() directive:DirectiveType`: any directive that matches the type on a direct parent element only.
|
* - `@Parent() directive:DirectiveType`: any directive that matches the type on a direct parent element only.
|
||||||
* - `@Children query:Query<DirectiveType>`: A live collection of direct child directives [TO BE IMPLEMENTED].
|
* - `@Children query:Query<DirectiveType>`: A live collection of direct child directives (will be implemented in later release).
|
||||||
* - `@Descendants query:Query<DirectiveType>`: A live collection of any child directives [TO BE IMPLEMENTED].
|
* - `@Descendants query:Query<DirectiveType>`: A live collection of any child directives (will be implemented in later relaese).
|
||||||
*
|
*
|
||||||
* To inject element-specific special objects, declare the constructor parameter as:
|
* To inject element-specific special objects, declare the constructor parameter as:
|
||||||
* - `element: NgElement` to obtain a DOM element (DEPRECATED: replacement coming)
|
* - `element: NgElement` to obtain a DOM element (DEPRECATED: replacement coming)
|
||||||
* - `viewContainer: ViewContainer` to control child template instantiation, for [Viewport] directives only
|
* - `viewContainer: ViewContainer` to control child template instantiation, for {@link Viewport} directives only
|
||||||
* - `bindingPropagation: BindingPropagation` to control change detection in a more granular way.
|
* - `bindingPropagation: BindingPropagation` to control change detection in a more granular way.
|
||||||
*
|
*
|
||||||
* ## Example
|
* ## Example
|
||||||
@ -184,32 +184,35 @@ import {DEFAULT} from 'angular2/change_detection';
|
|||||||
* `dependency="1"`.
|
* `dependency="1"`.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* ### Injecting a live collection of direct child directives [PENDING IMPLEMENTATION]
|
* ### Injecting a live collection of direct child directives
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* A directive can also query for other child directives. Since parent directives are instantiated before child
|
* A directive can also query for other child directives. Since parent directives are instantiated before child
|
||||||
* directives, a directive can't simply inject the list of child directives. Instead, the directive asynchronously
|
* directives, a directive can't simply inject the list of child directives. Instead, the directive
|
||||||
* injects a [Query], which updates as children are added, removed, or moved by any [ViewPort] directive such as a
|
* injects a {@link QueryList}, which updates its contents as children are added, removed, or moved by any
|
||||||
* `for`, an `if`, or a `switch`.
|
* {@link Viewport} directive such as a `for`, an `if`, or a `switch`.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* @Decorator({ selector: '[my-directive]' })
|
* @Decorator({ selector: '[my-directive]' })
|
||||||
* class MyDirective {
|
* class MyDirective {
|
||||||
* constructor(@Children() dependencies:Query<Maker>) {
|
* constructor(@Query(Marker) dependencies:QueryList<Maker>) {
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* This directive would be instantiated with a [Query] which contains `Dependency` 4 and 6. Here, `Dependency` 5 would
|
* This directive would be instantiated with a {@link QueryList} which contains `Dependency` 4 and 6. Here, `Dependency`
|
||||||
* not be included, because it is not a direct child.
|
* 5 would not be included, because it is not a direct child.
|
||||||
*
|
*
|
||||||
* ### Injecting a live collection of direct descendant directives [PENDING IMPLEMENTATION]
|
* ### Injecting a live collection of descendant directives
|
||||||
|
*
|
||||||
|
* Note: This is will be implemented in later release. ()
|
||||||
*
|
*
|
||||||
* Similar to `@Children` above, but also includes the children of the child elements.
|
* Similar to `@Children` above, but also includes the children of the child elements.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* @Decorator({ selector: '[my-directive]' })
|
* @Decorator({ selector: '[my-directive]' })
|
||||||
* class MyDirective {
|
* class MyDirective {
|
||||||
* constructor(@Children() dependencies:Query<Maker>) {
|
* constructor(@QueryDescendents(Marker) dependencies:QueryList<Maker>) {
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
@ -279,7 +282,7 @@ export class Directive extends Injectable {
|
|||||||
* - `directiveProperty` specifies the component property where the value is written.
|
* - `directiveProperty` specifies the component property where the value is written.
|
||||||
* - `bindingProperty` specifies the DOM property where the value is read from.
|
* - `bindingProperty` specifies the DOM property where the value is read from.
|
||||||
*
|
*
|
||||||
* You can include [Pipes] when specifying a `bindingProperty` to allow for data transformation and structural
|
* You can include a {@link Pipe} when specifying a `bindingProperty` to allow for data transformation and structural
|
||||||
* change detection of the value. These pipes will be evaluated in the context of this component.
|
* change detection of the value. These pipes will be evaluated in the context of this component.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -333,7 +336,9 @@ export class Directive extends Injectable {
|
|||||||
* You can also use pipes when writing binding definitions for a directive.
|
* You can also use pipes when writing binding definitions for a directive.
|
||||||
*
|
*
|
||||||
* For example, we could write a binding that updates the directive on structural changes, rather than on reference
|
* For example, we could write a binding that updates the directive on structural changes, rather than on reference
|
||||||
* changes, as normally occurs in change detection. (See: [Pipe] and [keyValueDiff] documentation for more details.)
|
* changes, as normally occurs in change detection.
|
||||||
|
*
|
||||||
|
* See {@link Pipe} and {@link keyValDiff} documentation for more details.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* @Decorator({
|
* @Decorator({
|
||||||
@ -399,7 +404,7 @@ export class Directive extends Injectable {
|
|||||||
* When writing a directive event binding, you can also refer to the following local variables:
|
* When writing a directive event binding, you can also refer to the following local variables:
|
||||||
* - `$event`: Current event object which triggered the event.
|
* - `$event`: Current event object which triggered the event.
|
||||||
* - `$target`: The source of the event. This will be either a DOM element or an Angular directive.
|
* - `$target`: The source of the event. This will be either a DOM element or an Angular directive.
|
||||||
* [TO BE IMPLEMENTED]
|
* (will be implemented in later release)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* ## Syntax
|
* ## Syntax
|
||||||
@ -443,7 +448,7 @@ export class Directive extends Injectable {
|
|||||||
/**
|
/**
|
||||||
* Specifies a set of lifecycle hostListeners in which the directive participates.
|
* Specifies a set of lifecycle hostListeners in which the directive participates.
|
||||||
*
|
*
|
||||||
* See: [onChange], [onDestroy], [onAllChangesDone] for details.
|
* See {@link onChange}, {@link onDestroy}, {@link onAllChangesDone} for details.
|
||||||
*/
|
*/
|
||||||
lifecycle:List; //List<LifecycleEvent>
|
lifecycle:List; //List<LifecycleEvent>
|
||||||
|
|
||||||
@ -471,9 +476,9 @@ export class Directive extends Injectable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if a directive participates in a given [LifecycleEvent].
|
* Returns true if a directive participates in a given `LifecycleEvent`.
|
||||||
*
|
*
|
||||||
* See: [onChange], [onDestroy], [onAllChangesDone] for details.
|
* See {@link onChange}, {@link onDestroy}, {@link onAllChangesDone} for details.
|
||||||
*/
|
*/
|
||||||
hasLifecycleHook(hook:string):boolean {
|
hasLifecycleHook(hook:string):boolean {
|
||||||
return isPresent(this.lifecycle) ? ListWrapper.contains(this.lifecycle, hook) : false;
|
return isPresent(this.lifecycle) ? ListWrapper.contains(this.lifecycle, hook) : false;
|
||||||
@ -489,11 +494,11 @@ export class Directive extends Injectable {
|
|||||||
* When a component is instantiated, Angular
|
* When a component is instantiated, Angular
|
||||||
* - creates a shadow DOM for the component.
|
* - creates a shadow DOM for the component.
|
||||||
* - loads the selected template into the shadow DOM.
|
* - loads the selected template into the shadow DOM.
|
||||||
* - creates a child [Injector] which is configured with the [Component.injectables].
|
* - creates a child {@link Injector} which is configured with the `injectables` for the {@link Component}.
|
||||||
*
|
*
|
||||||
* All template expressions and statements are then evaluated against the component instance.
|
* All template expressions and statements are then evaluated against the component instance.
|
||||||
*
|
*
|
||||||
* For details on the `@View` annotation, see [View].
|
* For details on the `@View` annotation, see {@link View}.
|
||||||
*
|
*
|
||||||
* ## Example
|
* ## Example
|
||||||
*
|
*
|
||||||
@ -530,17 +535,17 @@ export class Component extends Directive {
|
|||||||
/**
|
/**
|
||||||
* Defines the set of injectable objects that are visible to a Component and its children.
|
* Defines the set of injectable objects that are visible to a Component and its children.
|
||||||
*
|
*
|
||||||
* The [injectables] defined in the Component annotation allow you to configure a set of bindings for the component's
|
* The `injectables` defined in the Component annotation allow you to configure a set of bindings for the component's
|
||||||
* injector.
|
* injector.
|
||||||
*
|
*
|
||||||
* When a component is instantiated, Angular creates a new child Injector, which is configured with the bindings in
|
* When a component is instantiated, Angular creates a new child Injector, which is configured with the bindings in
|
||||||
* the Component [injectables] annotation. The injectable objects then become available for injection to the component
|
* the Component `injectables` annotation. The injectable objects then become available for injection to the component
|
||||||
* itself and any of the directives in the component's template, i.e. they are not available to the directives which
|
* itself and any of the directives in the component's template, i.e. they are not available to the directives which
|
||||||
* are children in the component's light DOM.
|
* are children in the component's light DOM.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* The syntax for configuring the [injectables] injectable is identical to [Injector] injectable configuration. See
|
* The syntax for configuring the `injectables` injectable is identical to {@link Injector} injectable configuration.
|
||||||
* [Injector] for additional detail.
|
* See {@link Injector} for additional detail.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* ## Simple Example
|
* ## Simple Example
|
||||||
@ -656,7 +661,7 @@ export class Component extends Directive {
|
|||||||
*/
|
*/
|
||||||
export class DynamicComponent extends Directive {
|
export class DynamicComponent extends Directive {
|
||||||
/**
|
/**
|
||||||
* Same as [Component.injectables].
|
* Same as `injectables` in the {@link Component}.
|
||||||
*/
|
*/
|
||||||
// TODO(vsankin): Please extract into AbstractComponent
|
// TODO(vsankin): Please extract into AbstractComponent
|
||||||
injectables:any; //List;
|
injectables:any; //List;
|
||||||
@ -696,10 +701,10 @@ export class DynamicComponent extends Directive {
|
|||||||
* (see: http://en.wikipedia.org/wiki/Composition_over_inheritance)
|
* (see: http://en.wikipedia.org/wiki/Composition_over_inheritance)
|
||||||
*
|
*
|
||||||
* Decorators:
|
* Decorators:
|
||||||
* - are simplest form of [Directive]s.
|
* - are simplest form of {@link Directive}s.
|
||||||
* - are best used as a composition pattern ()
|
* - are best used as a composition pattern ()
|
||||||
*
|
*
|
||||||
* Decorators differ from [Component]s in that they:
|
* Decorators differ from {@link Component}s in that they:
|
||||||
* - can have multiple decorators per element
|
* - can have multiple decorators per element
|
||||||
* - do not create their own evaluation context
|
* - do not create their own evaluation context
|
||||||
* - do not have a template (and therefor do not create Shadow DOM)
|
* - do not have a template (and therefor do not create Shadow DOM)
|
||||||
@ -788,11 +793,11 @@ export class Decorator extends Directive {
|
|||||||
/**
|
/**
|
||||||
* Directive that controls the instantiation, destruction, and positioning of inline template elements.
|
* Directive that controls the instantiation, destruction, and positioning of inline template elements.
|
||||||
*
|
*
|
||||||
* A viewport directive uses a [ViewContainer] to instantiate, insert, move, and destroy views at runtime.
|
* A viewport directive uses a {@link ViewContainer} to instantiate, insert, move, and destroy views at runtime.
|
||||||
* The [ViewContainer] is created as a result of `<template>` element, and represents a location in the current view
|
* The {@link ViewContainer} is created as a result of `<template>` element, and represents a location in the current view
|
||||||
* where these actions are performed.
|
* where these actions are performed.
|
||||||
*
|
*
|
||||||
* Views are always created as children of the current [View], and as siblings of the `<template>` element. Thus a
|
* Views are always created as children of the current {@link View}, and as siblings of the `<template>` element. Thus a
|
||||||
* directive in a child view cannot inject the viewport directive that created it.
|
* directive in a child view cannot inject the viewport directive that created it.
|
||||||
*
|
*
|
||||||
* Since viewport directives are common in Angular, and using the full `<template>` element syntax is wordy, Angular
|
* Since viewport directives are common in Angular, and using the full `<template>` element syntax is wordy, Angular
|
||||||
@ -906,7 +911,7 @@ export class Viewport extends Directive {
|
|||||||
//TODO(misko): turn into LifecycleEvent class once we switch to TypeScript;
|
//TODO(misko): turn into LifecycleEvent class once we switch to TypeScript;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify a directive whenever a [View] that contains it is destroyed.
|
* Notify a directive whenever a {@link View} that contains it is destroyed.
|
||||||
*
|
*
|
||||||
* ## Example
|
* ## Example
|
||||||
*
|
*
|
||||||
|
4
modules/angular2/src/core/annotations/di.js
vendored
4
modules/angular2/src/core/annotations/di.js
vendored
@ -69,9 +69,9 @@ export class Attribute extends DependencyAnnotation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies that a [QueryList] should be injected.
|
* Specifies that a {@link QueryList} should be injected.
|
||||||
*
|
*
|
||||||
* See: [QueryList] for usage and example.
|
* See {@link QueryList} for usage and example.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/annotations
|
* @exportedAs angular2/annotations
|
||||||
*/
|
*/
|
||||||
|
10
modules/angular2/src/core/annotations/view.js
vendored
10
modules/angular2/src/core/annotations/view.js
vendored
@ -1,7 +1,7 @@
|
|||||||
import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
|
import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declare the available HTML templates for an application.
|
* Declares the available HTML templates for an application.
|
||||||
*
|
*
|
||||||
* Each angular component requires a single `@Component` and at least one `@View` annotation. The @View
|
* Each angular component requires a single `@Component` and at least one `@View` annotation. The @View
|
||||||
* annotation specifies the HTML template to use, and lists the directives that are active within the template.
|
* annotation specifies the HTML template to use, and lists the directives that are active within the template.
|
||||||
@ -9,7 +9,7 @@ import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
|
|||||||
* When a component is instantiated, the template is loaded into the component's shadow root, and the
|
* When a component is instantiated, the template is loaded into the component's shadow root, and the
|
||||||
* expressions and statements in the template are evaluated against the component.
|
* expressions and statements in the template are evaluated against the component.
|
||||||
*
|
*
|
||||||
* For details on the `@Component` annotation, see [Component].
|
* For details on the `@Component` annotation, see {@link Component}.
|
||||||
*
|
*
|
||||||
* ## Example
|
* ## Example
|
||||||
*
|
*
|
||||||
@ -34,21 +34,21 @@ import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
|
|||||||
*/
|
*/
|
||||||
export class View {
|
export class View {
|
||||||
/**
|
/**
|
||||||
* Specify a template URL for an angular component.
|
* Specifies a template URL for an angular component.
|
||||||
*
|
*
|
||||||
* NOTE: either `templateURL` or `template` should be used, but not both.
|
* NOTE: either `templateURL` or `template` should be used, but not both.
|
||||||
*/
|
*/
|
||||||
templateUrl:any; //string;
|
templateUrl:any; //string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify an inline template for an angular component.
|
* Specifies an inline template for an angular component.
|
||||||
*
|
*
|
||||||
* NOTE: either `templateURL` or `template` should be used, but not both.
|
* NOTE: either `templateURL` or `template` should be used, but not both.
|
||||||
*/
|
*/
|
||||||
template:any; //string;
|
template:any; //string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify a list of directives that are active within a template. [TODO: true?]
|
* Specifies a list of directives that can be used within a template.
|
||||||
*
|
*
|
||||||
* Directives must be listed explicitly to provide proper component encapsulation.
|
* Directives must be listed explicitly to provide proper component encapsulation.
|
||||||
*
|
*
|
||||||
|
14
modules/angular2/src/core/application.js
vendored
14
modules/angular2/src/core/application.js
vendored
@ -199,7 +199,7 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
|
|||||||
* 2. It creates a new child injector (from the platform injector) and configures the injector with the component's
|
* 2. It creates a new child injector (from the platform injector) and configures the injector with the component's
|
||||||
* `injectables`. Optionally, you can also override the injector configuration for an app by invoking
|
* `injectables`. Optionally, you can also override the injector configuration for an app by invoking
|
||||||
* `bootstrap` with the `componentInjectableBindings` argument.
|
* `bootstrap` with the `componentInjectableBindings` argument.
|
||||||
* 3. It creates a new [Zone] and connects it to the angular application's change detection domain instance.
|
* 3. It creates a new `Zone` and connects it to the angular application's change detection domain instance.
|
||||||
* 4. It creates a shadow DOM on the selected component's host element and loads the template into it.
|
* 4. It creates a shadow DOM on the selected component's host element and loads the template into it.
|
||||||
* 5. It instantiates the specified component.
|
* 5. It instantiates the specified component.
|
||||||
* 6. Finally, Angular performs change detection to apply the initial data bindings for the application.
|
* 6. Finally, Angular performs change detection to apply the initial data bindings for the application.
|
||||||
@ -214,7 +214,7 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
|
|||||||
*
|
*
|
||||||
* Angular creates a new application each time that the `bootstrap()` method is invoked. When multiple applications
|
* Angular creates a new application each time that the `bootstrap()` method is invoked. When multiple applications
|
||||||
* are created for a page, Angular treats each application as independent within an isolated change detection and
|
* are created for a page, Angular treats each application as independent within an isolated change detection and
|
||||||
* [Zone] domain. If you need to share data between applications, use the strategy described in the next
|
* `Zone` domain. If you need to share data between applications, use the strategy described in the next
|
||||||
* section, "Applications That Share Change Detection."
|
* section, "Applications That Share Change Detection."
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -238,13 +238,13 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* # API
|
* # API
|
||||||
* - [appComponentType]: The root component which should act as the application. This is a reference to a [Type]
|
* - `appComponentType`: The root component which should act as the application. This is a reference to a `Type`
|
||||||
* which is annotated with `@Component(...)`.
|
* which is annotated with `@Component(...)`.
|
||||||
* - [componentInjectableBindings]: An additional set of bindings that can be added to the [Component.injectables] to
|
* - `componentInjectableBindings`: An additional set of bindings that can be added to `injectables` for the
|
||||||
* override default injection behavior.
|
* {@link Component} to override default injection behavior.
|
||||||
* - [errorReporter]: `function(exception:any, stackTrace:string)` a default error reporter for unhandled exceptions.
|
* - `errorReporter`: `function(exception:any, stackTrace:string)` a default error reporter for unhandled exceptions.
|
||||||
*
|
*
|
||||||
* Returns a [Promise] with the application`s private [Injector].
|
* Returns a `Promise` with the application`s private {@link Injector}.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/core
|
* @exportedAs angular2/core
|
||||||
*/
|
*/
|
||||||
|
@ -80,4 +80,4 @@ export class QueryList extends BaseQueryList {
|
|||||||
return super.removeCallback(callback);
|
return super.removeCallback(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,14 @@ import {isPresent} from 'angular2/src/facade/lang';
|
|||||||
/**
|
/**
|
||||||
* Provides access to explicitly trigger change detection in an application.
|
* Provides access to explicitly trigger change detection in an application.
|
||||||
*
|
*
|
||||||
* By default, [Zone] triggers change detection in Angular on each virtual machine (VM) turn. When testing, or in some
|
* By default, `Zone` triggers change detection in Angular on each virtual machine (VM) turn. When testing, or in some
|
||||||
* limited application use cases, a developer can also trigger change detection with the `lifecycle.tick()` method.
|
* limited application use cases, a developer can also trigger change detection with the `lifecycle.tick()` method.
|
||||||
*
|
*
|
||||||
* Each Angular application has a single `LifeCycle` instance.
|
* Each Angular application has a single `LifeCycle` instance.
|
||||||
*
|
*
|
||||||
* # Example
|
* # Example
|
||||||
*
|
*
|
||||||
* This is a contrived example, since the bootstrap automatically runs inside of the [Zone], which invokes
|
* This is a contrived example, since the bootstrap automatically runs inside of the `Zone`, which invokes
|
||||||
* `lifecycle.tick()` on your behalf.
|
* `lifecycle.tick()` on your behalf.
|
||||||
*
|
*
|
||||||
* ```javascript
|
* ```javascript
|
||||||
|
@ -4,19 +4,19 @@ import 'dart:async' as async;
|
|||||||
import 'package:stack_trace/stack_trace.dart' show Chain;
|
import 'package:stack_trace/stack_trace.dart' show Chain;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A [Zone] wrapper that lets you schedule tasks after its private microtask queue is exhausted but
|
* A `Zone` wrapper that lets you schedule tasks after its private microtask queue is exhausted but
|
||||||
* before the next "VM turn", i.e. event loop iteration.
|
* before the next "VM turn", i.e. event loop iteration.
|
||||||
*
|
*
|
||||||
* This lets you freely schedule microtasks that prepare data, and set an [onTurnDone] handler that
|
* This lets you freely schedule microtasks that prepare data, and set an {@link onTurnDone} handler that
|
||||||
* will consume that data after it's ready but before the browser has a chance to re-render.
|
* will consume that data after it's ready but before the browser has a chance to re-render.
|
||||||
*
|
*
|
||||||
* A VM turn consist of a single macrotask followed 0 to many microtasks.
|
* A VM turn consist of a single macrotask followed 0 to many microtasks.
|
||||||
*
|
*
|
||||||
* The wrapper maintains an "inner" and "outer" [Zone]. The application code will executes
|
* The wrapper maintains an "inner" and "outer" `Zone`. The application code will executes
|
||||||
* in the "inner" zone unless [runOutsideAngular] is explicitely called.
|
* in the "inner" zone unless `runOutsideAngular` is explicitely called.
|
||||||
*
|
*
|
||||||
* A typical application will create a singleton [VmTurnZone] whose outer [Zone] is the root [Zone]
|
* A typical application will create a singleton `VmTurnZone` whose outer `Zone` is the root `Zone`
|
||||||
* and whose default [onTurnDone] runs the Angular digest.
|
* and whose default `onTurnDone` runs the Angular digest.
|
||||||
*/
|
*/
|
||||||
class VmTurnZone {
|
class VmTurnZone {
|
||||||
Function _onTurnStart;
|
Function _onTurnStart;
|
||||||
@ -32,8 +32,8 @@ class VmTurnZone {
|
|||||||
/**
|
/**
|
||||||
* Associates with this
|
* Associates with this
|
||||||
*
|
*
|
||||||
* - an "outer" [Zone], which is the one that created this.
|
* - an "outer" `Zone`, which is the one that created this.
|
||||||
* - an "inner" [Zone], which is a child of the outer [Zone].
|
* - an "inner" `Zone`, which is a child of the outer `Zone`.
|
||||||
*
|
*
|
||||||
* @param {bool} enableLongStackTrace whether to enable long stack trace. They should only be
|
* @param {bool} enableLongStackTrace whether to enable long stack trace. They should only be
|
||||||
* enabled in development mode as they significantly impact perf.
|
* enabled in development mode as they significantly impact perf.
|
||||||
@ -60,7 +60,7 @@ class VmTurnZone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs [fn] in the inner zone and returns whatever it returns.
|
* Runs `fn` in the inner zone and returns whatever it returns.
|
||||||
*
|
*
|
||||||
* In a typical app where the inner zone is the Angular zone, this allows one to make use of the
|
* In a typical app where the inner zone is the Angular zone, this allows one to make use of the
|
||||||
* Angular's auto digest mechanism.
|
* Angular's auto digest mechanism.
|
||||||
@ -78,7 +78,7 @@ class VmTurnZone {
|
|||||||
dynamic run(fn()) => _innerZone.run(fn);
|
dynamic run(fn()) => _innerZone.run(fn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs [fn] in the outer zone and returns whatever it returns.
|
* Runs `fn` in the outer zone and returns whatever it returns.
|
||||||
*
|
*
|
||||||
* In a typical app where the inner zone is the Angular zone, this allows one to escape Angular's
|
* In a typical app where the inner zone is the Angular zone, this allows one to escape Angular's
|
||||||
* auto-digest mechanism.
|
* auto-digest mechanism.
|
||||||
|
@ -4,11 +4,11 @@ import {normalizeBlank, isPresent, global} from 'angular2/src/facade/lang';
|
|||||||
/**
|
/**
|
||||||
* A wrapper around zones that lets you schedule tasks after it has executed a task.
|
* A wrapper around zones that lets you schedule tasks after it has executed a task.
|
||||||
*
|
*
|
||||||
* The wrapper maintains an "inner" and "outer" [Zone]. The application code will executes
|
* The wrapper maintains an "inner" and "outer" `Zone`. The application code will executes
|
||||||
* in the "inner" zone unless [runOutsideAngular] is explicitely called.
|
* in the "inner" zone unless `runOutsideAngular` is explicitely called.
|
||||||
*
|
*
|
||||||
* A typical application will create a singleton [VmTurnZone] whose outer [Zone] is the root [Zone]
|
* A typical application will create a singleton `VmTurnZone` whose outer `Zone` is the root `Zone`
|
||||||
* and whose default [onTurnDone] runs the Angular digest.
|
* and whose default `onTurnDone` runs the Angular digest.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/core
|
* @exportedAs angular2/core
|
||||||
*/
|
*/
|
||||||
@ -56,7 +56,7 @@ export class VmTurnZone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs [fn] in the inner zone and returns whatever it returns.
|
* Runs `fn` in the inner zone and returns whatever it returns.
|
||||||
*
|
*
|
||||||
* In a typical app where the inner zone is the Angular zone, this allows one to make use of the
|
* In a typical app where the inner zone is the Angular zone, this allows one to make use of the
|
||||||
* Angular's auto digest mechanism.
|
* Angular's auto digest mechanism.
|
||||||
@ -74,7 +74,7 @@ export class VmTurnZone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs [fn] in the outer zone and returns whatever it returns.
|
* Runs `fn` in the outer zone and returns whatever it returns.
|
||||||
*
|
*
|
||||||
* In a typical app where the inner zone is the Angular zone, this allows one to escape Angular's
|
* In a typical app where the inner zone is the Angular zone, this allows one to escape Angular's
|
||||||
* auto-digest mechanism.
|
* auto-digest mechanism.
|
||||||
|
6
modules/angular2/src/di/annotations.js
vendored
6
modules/angular2/src/di/annotations.js
vendored
@ -20,7 +20,7 @@ export class Inject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A parameter annotation that specifies a [Promise] of a dependency.
|
* A parameter annotation that specifies a `Promise` of a dependency.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* class AComponent {
|
* class AComponent {
|
||||||
@ -62,9 +62,9 @@ export class InjectLazy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A parameter annotation that marks a dependency as optional. [Injector] provides `null` if the dependency is not
|
* A parameter annotation that marks a dependency as optional. {@link Injector} provides `null` if the dependency is not
|
||||||
* found.
|
* found.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* class AComponent {
|
* class AComponent {
|
||||||
* constructor(@Optional() aService:MyService) {
|
* constructor(@Optional() aService:MyService) {
|
||||||
|
38
modules/angular2/src/di/binding.js
vendored
38
modules/angular2/src/di/binding.js
vendored
@ -31,9 +31,9 @@ export class Dependency {
|
|||||||
var _EMPTY_LIST = []; // TODO: make const when supported
|
var _EMPTY_LIST = []; // TODO: make const when supported
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes how the [Injector] should instantiate a given token.
|
* Describes how the {@link Injector} should instantiate a given token.
|
||||||
*
|
*
|
||||||
* See [bind].
|
* See {@link bind}.
|
||||||
*
|
*
|
||||||
* ## Example
|
* ## Example
|
||||||
*
|
*
|
||||||
@ -50,7 +50,7 @@ var _EMPTY_LIST = []; // TODO: make const when supported
|
|||||||
export class Binding {
|
export class Binding {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token used when retrieving this binding. Usually the [Type].
|
* Token used when retrieving this binding. Usually the `Type`.
|
||||||
*/
|
*/
|
||||||
token;
|
token;
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ export class Binding {
|
|||||||
/**
|
/**
|
||||||
* Binds a key to the alias for an existing key.
|
* Binds a key to the alias for an existing key.
|
||||||
*
|
*
|
||||||
* An alias means that [Injector] returns the same instance as if the alias token was used. This is in contrast to
|
* An alias means that {@link Injector} returns the same instance as if the alias token was used. This is in contrast to
|
||||||
* `toClass` where a separate instance of `toClass` is returned.
|
* `toClass` where a separate instance of `toClass` is returned.
|
||||||
*
|
*
|
||||||
* ## Example
|
* ## Example
|
||||||
@ -171,9 +171,9 @@ export class Binding {
|
|||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* The interesting thing to note is that event though `Number` has an async factory, the `String` factory
|
* The interesting thing to note is that event though `Number` has an async factory, the `String` factory
|
||||||
* function takes the resolved value. This shows that the [Injector] delays executing the `String` factory
|
* function takes the resolved value. This shows that the {@link Injector} delays executing the `String` factory
|
||||||
* until after the `Number` is resolved. This can only be done if the `token` is retrieved using the
|
* until after the `Number` is resolved. This can only be done if the `token` is retrieved using the
|
||||||
* [Injector.asyncGet] API.
|
* `asyncGet` API in the {@link Injector}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
toAsyncFactory:Function;
|
toAsyncFactory:Function;
|
||||||
@ -218,9 +218,9 @@ export class Binding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the [Binding] into [ResolvedBinding].
|
* Converts the {@link Binding} into {@link ResolvedBinding}.
|
||||||
*
|
*
|
||||||
* [Injector] internaly only uses [ResolvedBindings], [Binding] contains convenience sugar.
|
* {@link Injector} internally only uses {@link ResolvedBinding}, {@link Binding} contains convenience binding syntax.
|
||||||
*/
|
*/
|
||||||
resolve(): ResolvedBinding {
|
resolve(): ResolvedBinding {
|
||||||
var factoryFn:Function;
|
var factoryFn:Function;
|
||||||
@ -254,31 +254,31 @@ export class Binding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An internal resolved representation of a [Binding] used by the [Injector].
|
* An internal resolved representation of a {@link Binding} used by the {@link Injector}.
|
||||||
*
|
*
|
||||||
* A [Binding] is resolved when it has a factory function. Binding to a class, alias, or value, are just convenience
|
* A {@link Binding} is resolved when it has a factory function. Binding to a class, alias, or value, are just convenience
|
||||||
* methods, as [Injector] only operates on calling factory functions.
|
* methods, as {@link Injector} only operates on calling factory functions.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/di
|
* @exportedAs angular2/di
|
||||||
*/
|
*/
|
||||||
export class ResolvedBinding {
|
export class ResolvedBinding {
|
||||||
/**
|
/**
|
||||||
* A key, usually a [Type].
|
* A key, usually a `Type`.
|
||||||
*/
|
*/
|
||||||
key:Key;
|
key:Key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory function which can return an instance of represented by a [key].
|
* Factory function which can return an instance of an object represented by a key.
|
||||||
*/
|
*/
|
||||||
factory:Function;
|
factory:Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Arguments (dependencies) to the [factory] function.
|
* Arguments (dependencies) to the `factory` function.
|
||||||
*/
|
*/
|
||||||
dependencies:List<Dependency>;
|
dependencies:List<Dependency>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies whether the [factory] function returns a [Promise].
|
* Specifies whether the `factory` function returns a `Promise`.
|
||||||
*/
|
*/
|
||||||
providedAsPromise:boolean;
|
providedAsPromise:boolean;
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ export class ResolvedBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides an API for imperatively constructing [Binding]s.
|
* Provides an API for imperatively constructing {@link Binding}s.
|
||||||
*
|
*
|
||||||
* This is only relevant for JavaScript. See {@link BindingBuilder}.
|
* This is only relevant for JavaScript. See {@link BindingBuilder}.
|
||||||
*
|
*
|
||||||
@ -309,7 +309,7 @@ export function bind(token):BindingBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class for the [bind] function.
|
* Helper class for the {@link bind} function.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/di
|
* @exportedAs angular2/di
|
||||||
*/
|
*/
|
||||||
@ -446,9 +446,9 @@ export class BindingBuilder {
|
|||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* The interesting thing to note is that event though `Number` has an async factory, the `String` factory
|
* The interesting thing to note is that event though `Number` has an async factory, the `String` factory
|
||||||
* function takes the resolved value. This shows that the [Injector] delays executing of the `String` factory
|
* function takes the resolved value. This shows that the {@link Injector} delays executing of the `String` factory
|
||||||
* until after the `Number` is resolved. This can only be done if the `token` is retrieved using the
|
* until after the `Number` is resolved. This can only be done if the `token` is retrieved using the
|
||||||
* [Injector.asyncGet] API.
|
* the `asyncGet` API in the {@link Injector}.
|
||||||
*/
|
*/
|
||||||
toAsyncFactory(factoryFunction:Function, dependencies:List = null):Binding {
|
toAsyncFactory(factoryFunction:Function, dependencies:List = null):Binding {
|
||||||
return new Binding(this.token, {
|
return new Binding(this.token, {
|
||||||
|
10
modules/angular2/src/di/exceptions.js
vendored
10
modules/angular2/src/di/exceptions.js
vendored
@ -54,8 +54,8 @@ export class AbstractBindingError extends Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when trying to retrieve a dependency by [Key] from [Injector], but the [Injector] does not have a [Binding]
|
* Thrown when trying to retrieve a dependency by `Key` from {@link Injector}, but the {@link Injector} does not have a
|
||||||
* for [Key].
|
* {@link Binding} for {@link Key}.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/di_errors
|
* @exportedAs angular2/di_errors
|
||||||
*/
|
*/
|
||||||
@ -70,7 +70,7 @@ export class NoBindingError extends AbstractBindingError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when trying to retrieve an async [Binding] using the sync API.
|
* Thrown when trying to retrieve an async {@link Binding} using the sync API.
|
||||||
*
|
*
|
||||||
* ## Example
|
* ## Example
|
||||||
*
|
*
|
||||||
@ -151,7 +151,7 @@ export class InstantiationError extends AbstractBindingError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when an object other then [Binding] (or [Type]) is passed to [Injector] creation.
|
* Thrown when an object other then {@link Binding} (or `Type`) is passed to {@link Injector} creation.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/di_errors
|
* @exportedAs angular2/di_errors
|
||||||
*/
|
*/
|
||||||
@ -170,7 +170,7 @@ export class InvalidBindingError extends Error {
|
|||||||
/**
|
/**
|
||||||
* Thrown when the class has no annotation information.
|
* Thrown when the class has no annotation information.
|
||||||
*
|
*
|
||||||
* Lack of annotation information prevents the [Injector] from determining which dependencies need to be injected into
|
* Lack of annotation information prevents the {@link Injector} from determining which dependencies need to be injected into
|
||||||
* the constructor.
|
* the constructor.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/di_errors
|
* @exportedAs angular2/di_errors
|
||||||
|
56
modules/angular2/src/di/injector.js
vendored
56
modules/angular2/src/di/injector.js
vendored
@ -70,14 +70,15 @@ export class Injector {
|
|||||||
* Turns a list of binding definitions into an internal resolved list of resolved bindings.
|
* Turns a list of binding definitions into an internal resolved list of resolved bindings.
|
||||||
*
|
*
|
||||||
* A resolution is a process of flattening multiple nested lists and converting individual bindings into a
|
* A resolution is a process of flattening multiple nested lists and converting individual bindings into a
|
||||||
* list of [ResolvedBinding]s. The resolution can be cached by [Injector.resolve] for performance-sensitive
|
* list of {@link ResolvedBinding}s. The resolution can be cached by `resolve` for the {@link Injector} for
|
||||||
* code.
|
* performance-sensitive code.
|
||||||
*
|
*
|
||||||
* @param [bindings] can be a list of [Type], [Binding], [ResolvedBinding], or a recursive list of more bindings.
|
* @param `bindings` can be a list of `Type`, {@link Binding}, {@link ResolvedBinding}, or a recursive
|
||||||
|
* list of more bindings.
|
||||||
*
|
*
|
||||||
* The returned list is sparse, indexed by [Key.id]. It is generally not useful to application code other than for
|
* The returned list is sparse, indexed by `id` for the {@link Key}. It is generally not useful to application code
|
||||||
* passing it to [Injector] functions that require resolved binding lists, such as [fromResolvedBindings] and
|
* other than for passing it to {@link Injector} functions that require resolved binding lists, such as
|
||||||
* [createChildFromResolved].
|
* `fromResolvedBindings` and `createChildFromResolved`.
|
||||||
*/
|
*/
|
||||||
static resolve(bindings:List/*<ResolvedBinding|Binding|Type|List>*/):List<ResolvedBinding> {
|
static resolve(bindings:List/*<ResolvedBinding|Binding|Type|List>*/):List<ResolvedBinding> {
|
||||||
var resolvedBindings = _resolveBindings(bindings);
|
var resolvedBindings = _resolveBindings(bindings);
|
||||||
@ -87,12 +88,14 @@ export class Injector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves bindings and creates an injector based on those bindings. This function is slower than the
|
* Resolves bindings and creates an injector based on those bindings. This function is slower than the
|
||||||
* corresponding [fromResolvedBindings] because it needs to resolve bindings first. See [Injector.resolve].
|
* corresponding `fromResolvedBindings` because it needs to resolve bindings first. See `resolve` for the
|
||||||
|
* {@link Injector}.
|
||||||
*
|
*
|
||||||
* Prefer [fromResolvedBindings] in performance-critical code that creates lots of injectors.
|
* Prefer `fromResolvedBindings` in performance-critical code that creates lots of injectors.
|
||||||
*
|
*
|
||||||
* @param [bindings] can be a list of [Type], [Binding], [ResolvedBinding], or a recursive list of more bindings.
|
* @param `bindings` can be a list of `Type`, {@link Binding}, {@link ResolvedBinding}, or a recursive list of more
|
||||||
* @param [defaultBindings] Setting to true will auto-create bindings.
|
* bindings.
|
||||||
|
* @param `defaultBindings` Setting to true will auto-create bindings.
|
||||||
*/
|
*/
|
||||||
static resolveAndCreate(bindings:List/*<ResolvedBinding|Binding|Type|List>*/, {defaultBindings=false}={}) {
|
static resolveAndCreate(bindings:List/*<ResolvedBinding|Binding|Type|List>*/, {defaultBindings=false}={}) {
|
||||||
return new Injector(Injector.resolve(bindings), null, defaultBindings);
|
return new Injector(Injector.resolve(bindings), null, defaultBindings);
|
||||||
@ -102,17 +105,17 @@ export class Injector {
|
|||||||
* Creates an injector from previously resolved bindings. This bypasses resolution and flattening. This API is the
|
* Creates an injector from previously resolved bindings. This bypasses resolution and flattening. This API is the
|
||||||
* recommended way to construct injectors in performance-sensitive parts.
|
* recommended way to construct injectors in performance-sensitive parts.
|
||||||
*
|
*
|
||||||
* @param [bindings] A sparse list of [ResolvedBinding]s. See [Injector.resolve].
|
* @param `bindings` A sparse list of {@link ResolvedBinding}s. See `resolve` for the {@link Injector}.
|
||||||
* @param [defaultBindings] Setting to true will auto-create bindings.
|
* @param `defaultBindings` Setting to true will auto-create bindings.
|
||||||
*/
|
*/
|
||||||
static fromResolvedBindings(bindings:List<ResolvedBinding>, {defaultBindings=false}={}) {
|
static fromResolvedBindings(bindings:List<ResolvedBinding>, {defaultBindings=false}={}) {
|
||||||
return new Injector(bindings, null, defaultBindings);
|
return new Injector(bindings, null, defaultBindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param [bindings] A sparse list of [ResolvedBinding]s. See [Injector.resolve].
|
* @param `bindings` A sparse list of {@link ResolvedBinding}s. See `resolve` for the {@link Injector}.
|
||||||
* @param [parent] Parent Injector or `null` if root injector.
|
* @param `parent` Parent Injector or `null` if root Injector.
|
||||||
* @param [defaultBindings] Setting to true will auto-create bindings. (Only use with root injector.)
|
* @param `defaultBindings` Setting to true will auto-create bindings. (Only use with root injector.)
|
||||||
*/
|
*/
|
||||||
constructor(bindings:List<ResolvedBinding>, parent:Injector, defaultBindings:boolean) {
|
constructor(bindings:List<ResolvedBinding>, parent:Injector, defaultBindings:boolean) {
|
||||||
this._bindings = bindings;
|
this._bindings = bindings;
|
||||||
@ -126,7 +129,7 @@ export class Injector {
|
|||||||
/**
|
/**
|
||||||
* Retrieves an instance from the injector.
|
* Retrieves an instance from the injector.
|
||||||
*
|
*
|
||||||
* @param [token] usually the [Type] of an object. (Same as the token used while setting up a binding).
|
* @param `token`: usually the `Type` of an object. (Same as the token used while setting up a binding).
|
||||||
* @returns an instance represented by the token. Throws if not found.
|
* @returns an instance represented by the token. Throws if not found.
|
||||||
*/
|
*/
|
||||||
get(token) {
|
get(token) {
|
||||||
@ -138,7 +141,7 @@ export class Injector {
|
|||||||
/**
|
/**
|
||||||
* Retrieves an instance from the injector.
|
* Retrieves an instance from the injector.
|
||||||
*
|
*
|
||||||
* @param [token] usually a [Type]. (Same as the token used while setting up a binding).
|
* @param `token`: usually a `Type`. (Same as the token used while setting up a binding).
|
||||||
* @returns an instance represented by the token. Returns `null` if not found.
|
* @returns an instance represented by the token. Returns `null` if not found.
|
||||||
*/
|
*/
|
||||||
getOptional(token) {
|
getOptional(token) {
|
||||||
@ -148,8 +151,8 @@ export class Injector {
|
|||||||
/**
|
/**
|
||||||
* Retrieves an instance from the injector asynchronously. Used with asynchronous bindings.
|
* Retrieves an instance from the injector asynchronously. Used with asynchronous bindings.
|
||||||
*
|
*
|
||||||
* @param [token] usually a [Type]. (Same as token used while setting up a binding).
|
* @param `token`: usually a `Type`. (Same as token used while setting up a binding).
|
||||||
* @returns a [Promise] which resolves to the instance represented by the token.
|
* @returns a `Promise` which resolves to the instance represented by the token.
|
||||||
*/
|
*/
|
||||||
asyncGet(token):Promise {
|
asyncGet(token):Promise {
|
||||||
return this._getByKey(Key.get(token), true, false, false);
|
return this._getByKey(Key.get(token), true, false, false);
|
||||||
@ -159,23 +162,22 @@ export class Injector {
|
|||||||
* Creates a child injector and loads a new set of bindings into it.
|
* Creates a child injector and loads a new set of bindings into it.
|
||||||
*
|
*
|
||||||
* A resolution is a process of flattening multiple nested lists and converting individual bindings into a
|
* A resolution is a process of flattening multiple nested lists and converting individual bindings into a
|
||||||
* list of [ResolvedBinding]s. The resolution can be cached by [Injector.resolve] for performance-sensitive
|
* list of {@link ResolvedBinding}s. The resolution can be cached by `resolve` for the {@link Injector} for
|
||||||
* code.
|
* performance-sensitive code.
|
||||||
*
|
*
|
||||||
* See: [Injector.resolve].
|
* @param `bindings` can be a list of `Type`, {@link Binding}, {@link ResolvedBinding}, or a recursive
|
||||||
|
* list of more bindings.
|
||||||
*
|
*
|
||||||
* @param [bindings] can be a list of [Type], [Binding], [ResolvedBinding], or a recursive list of more bindings.
|
|
||||||
* @returns a new child `Injector`.
|
|
||||||
*/
|
*/
|
||||||
resolveAndCreateChild(bindings:List/*<ResolvedBinding|Binding|Type|List>*/):Injector {
|
resolveAndCreateChild(bindings:List/*<ResolvedBinding|Binding|Type|List>*/):Injector {
|
||||||
return new Injector(Injector.resolve(bindings), this, false);
|
return new Injector(Injector.resolve(bindings), this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a child injector and loads a new set of [ResolvedBinding]s into it.
|
* Creates a child injector and loads a new set of {@link ResolvedBinding}s into it.
|
||||||
*
|
*
|
||||||
* @param [bindings] A sparse list of [ResolvedBinding]s. See [Injector.resolve].
|
* @param `bindings`: A sparse list of {@link ResolvedBinding}s. See `resolve` for the {@link Injector}.
|
||||||
* @returns a new child `Injector`.
|
* @returns a new child {@link Injector}.
|
||||||
*/
|
*/
|
||||||
createChildFromResolved(bindings:List<ResolvedBinding>):Injector {
|
createChildFromResolved(bindings:List<ResolvedBinding>):Injector {
|
||||||
return new Injector(bindings, this, false);
|
return new Injector(bindings, this, false);
|
||||||
|
14
modules/angular2/src/di/key.js
vendored
14
modules/angular2/src/di/key.js
vendored
@ -4,13 +4,13 @@ import {MapWrapper} from 'angular2/src/facade/collection';
|
|||||||
// TODO: uncoment `int` once https://github.com/angular/angular/issues/1414 is fixed
|
// TODO: uncoment `int` once https://github.com/angular/angular/issues/1414 is fixed
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A unique object used for retrieving items from the [Injector].
|
* A unique object used for retrieving items from the {@link Injector}.
|
||||||
*
|
*
|
||||||
* [Key]s have:
|
* Keys have:
|
||||||
* - a system-wide unique [id].
|
* - a system-wide unique `id`.
|
||||||
* - a [token], usually the [Type] of the instance.
|
* - a `token`, usually the `Type` of the instance.
|
||||||
*
|
*
|
||||||
* [Key]s are used internally in [Injector]s because their system-wide unique [id]s allow the
|
* Keys are used internally by the {@link Injector} because their system-wide unique `id`s allow the
|
||||||
* injector to index in arrays rather than looking up items in maps.
|
* injector to index in arrays rather than looking up items in maps.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/di
|
* @exportedAs angular2/di
|
||||||
@ -26,14 +26,14 @@ export class Key {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a [Key] for a token.
|
* Retrieves a `Key` for a token.
|
||||||
*/
|
*/
|
||||||
static get(token):Key {
|
static get(token):Key {
|
||||||
return _globalKeyRegistry.get(token);
|
return _globalKeyRegistry.get(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns the number of [Key]s registered in the system.
|
* @returns the number of keys registered in the system.
|
||||||
*/
|
*/
|
||||||
static get numberOfKeys()/* :int */ {
|
static get numberOfKeys()/* :int */ {
|
||||||
return _globalKeyRegistry.numberOfKeys;
|
return _globalKeyRegistry.numberOfKeys;
|
||||||
|
@ -200,7 +200,7 @@ class Html5LibDomAdapter implements DomAdapter {
|
|||||||
String tagName(element) => element.localName;
|
String tagName(element) => element.localName;
|
||||||
|
|
||||||
attributeMap(element) {
|
attributeMap(element) {
|
||||||
// `attributes` keys can be [AttributeName]s.
|
// `attributes` keys can be {@link AttributeName}s.
|
||||||
var map = <String, String>{};
|
var map = <String, String>{};
|
||||||
element.attributes.forEach((key, value) {
|
element.attributes.forEach((key, value) {
|
||||||
map['$key'] = value;
|
map['$key'] = value;
|
||||||
|
6
modules/angular2/src/forms/directives.js
vendored
6
modules/angular2/src/forms/directives.js
vendored
@ -11,7 +11,7 @@ import {Validators} from './validators';
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default accessor for writing a value and listening to changes that is used by a [Control] directive.
|
* The default accessor for writing a value and listening to changes that is used by a {@link Control} directive.
|
||||||
*
|
*
|
||||||
* This is the default strategy that Angular uses when no other accessor is applied.
|
* This is the default strategy that Angular uses when no other accessor is applied.
|
||||||
*
|
*
|
||||||
@ -84,7 +84,7 @@ export class CheckboxControlValueAccessor {
|
|||||||
* the control will reflect that change. Likewise, if the value of the control changes, the input element reflects that
|
* the control will reflect that change. Likewise, if the value of the control changes, the input element reflects that
|
||||||
* change.
|
* change.
|
||||||
*
|
*
|
||||||
* Here we use [FormDirectives], rather than importing each form directive individually, e.g.
|
* Here we use {@link FormDirectives}, rather than importing each form directive individually, e.g.
|
||||||
* `ControlDirective`, `ControlGroupDirective`. This is just a shorthand for the same end result.
|
* `ControlDirective`, `ControlGroupDirective`. This is just a shorthand for the same end result.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
@ -170,7 +170,7 @@ export class ControlDirective {
|
|||||||
* In this example, we bind the control group to the form element, and we bind the login and password controls to the
|
* In this example, we bind the control group to the form element, and we bind the login and password controls to the
|
||||||
* login and password elements.
|
* login and password elements.
|
||||||
*
|
*
|
||||||
* Here we use [FormDirectives], rather than importing each form directive individually, e.g.
|
* Here we use {@link FormDirectives}, rather than importing each form directive individually, e.g.
|
||||||
* `ControlDirective`, `ControlGroupDirective`. This is just a shorthand for the same end result.
|
* `ControlDirective`, `ControlGroupDirective`. This is just a shorthand for the same end result.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
|
4
modules/angular2/src/forms/form_builder.js
vendored
4
modules/angular2/src/forms/form_builder.js
vendored
@ -8,8 +8,8 @@ import * as modelModule from './model';
|
|||||||
*
|
*
|
||||||
* # Example
|
* # Example
|
||||||
*
|
*
|
||||||
* This example creates a [ControlGroup] that consists of a `login` [Control], and a nested [ControlGroup] that defines
|
* This example creates a {@link ControlGroup} that consists of a `login` {@link Control}, and a nested
|
||||||
* a `password` and a `passwordConfirmation` [Control].
|
* {@link ControlGroup} that defines a `password` and a `passwordConfirmation` {@link Control}.
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* var loginForm = builder.group({
|
* var loginForm = builder.group({
|
||||||
|
26
modules/angular2/src/forms/model.js
vendored
26
modules/angular2/src/forms/model.js
vendored
@ -89,8 +89,8 @@ export class AbstractControl {
|
|||||||
/**
|
/**
|
||||||
* Defines a part of a form that cannot be divided into other controls.
|
* Defines a part of a form that cannot be divided into other controls.
|
||||||
*
|
*
|
||||||
* `Control` is one of the three fundamental building blocks used to define forms in Angular, along with [ControlGroup]
|
* `Control` is one of the three fundamental building blocks used to define forms in Angular, along with
|
||||||
* and [ControlArray].
|
* {@link ControlGroup} and {@link ControlArray}.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/forms
|
* @exportedAs angular2/forms
|
||||||
*/
|
*/
|
||||||
@ -120,12 +120,13 @@ export class Control extends AbstractControl {
|
|||||||
/**
|
/**
|
||||||
* Defines a part of a form, of fixed length, that can contain other controls.
|
* Defines a part of a form, of fixed length, that can contain other controls.
|
||||||
*
|
*
|
||||||
* A ControlGroup aggregates the values and errors of each [Control] in the group. Thus, if one of the controls in a
|
* A ControlGroup aggregates the values and errors of each {@link Control} in the group. Thus, if one of the controls
|
||||||
* group is invalid, the entire group is invalid. Similarly, if a control changes its value, the entire group changes
|
* in a group is invalid, the entire group is invalid. Similarly, if a control changes its value, the entire group
|
||||||
* as well.
|
* changes as well.
|
||||||
*
|
*
|
||||||
* `ControlGroup` is one of the three fundamental building blocks used to define forms in Angular, along with [Control]
|
* `ControlGroup` is one of the three fundamental building blocks used to define forms in Angular, along with
|
||||||
* and [ControlArray]. [ControlArray] can also contain other controls, but is of variable length.
|
* {@link Control} and {@link ControlArray}. {@link ControlArray} can also contain other controls, but is of variable
|
||||||
|
* length.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/forms
|
* @exportedAs angular2/forms
|
||||||
*/
|
*/
|
||||||
@ -206,12 +207,13 @@ export class ControlGroup extends AbstractControl {
|
|||||||
/**
|
/**
|
||||||
* Defines a part of a form, of variable length, that can contain other controls.
|
* Defines a part of a form, of variable length, that can contain other controls.
|
||||||
*
|
*
|
||||||
* A `ControlArray` aggregates the values and errors of each [Control] in the group. Thus, if one of the controls in a
|
* A `ControlArray` aggregates the values and errors of each {@link Control} in the group. Thus, if one of the controls
|
||||||
* group is invalid, the entire group is invalid. Similarly, if a control changes its value, the entire group changes
|
* in a group is invalid, the entire group is invalid. Similarly, if a control changes its value, the entire group
|
||||||
* as well.
|
* changes as well.
|
||||||
*
|
*
|
||||||
* `ControlArray` is one of the three fundamental building blocks used to define forms in Angular, along with [Control]
|
* `ControlArray` is one of the three fundamental building blocks used to define forms in Angular, along with
|
||||||
* and [ControlGroup]. [ControlGroup] can also contain other controls, but is of fixed length.
|
* {@link Control} and {@link ControlGroup}. {@link ControlGroup} can also contain other controls, but is of fixed
|
||||||
|
* length.
|
||||||
*
|
*
|
||||||
* @exportedAs angular2/forms
|
* @exportedAs angular2/forms
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +19,7 @@ export class MockTemplateResolver extends TemplateResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the [View] for a component.
|
* Overrides the {@link View} for a component.
|
||||||
*
|
*
|
||||||
* @param {Type} component
|
* @param {Type} component
|
||||||
* @param {ViewDefinition} view
|
* @param {ViewDefinition} view
|
||||||
@ -41,7 +41,7 @@ export class MockTemplateResolver extends TemplateResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides a directive from the component [View].
|
* Overrides a directive from the component {@link View}.
|
||||||
*
|
*
|
||||||
* @param {Type} component
|
* @param {Type} component
|
||||||
* @param {Type} from
|
* @param {Type} from
|
||||||
@ -61,11 +61,11 @@ export class MockTemplateResolver extends TemplateResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the [View] for a component:
|
* Returns the {@link View} for a component:
|
||||||
* - Set the [View] to the overridden template when it exists or fallback to the default
|
* - Set the {@link View} to the overridden template when it exists or fallback to the default `TemplateResolver`,
|
||||||
* [TemplateResolver], see [setView]
|
* see `setView`.
|
||||||
* - Override the directives, see [overrideTemplateDirective]
|
* - Override the directives, see `overrideTemplateDirective`.
|
||||||
* - Override the @View definition, see [setInlineTemplate]
|
* - Override the @View definition, see `setInlineTemplate`.
|
||||||
*
|
*
|
||||||
* @param component
|
* @param component
|
||||||
* @returns {ViewDefinition}
|
* @returns {ViewDefinition}
|
||||||
|
@ -68,8 +68,8 @@ export class CompileControl {
|
|||||||
/**
|
/**
|
||||||
* Ignores the current element.
|
* Ignores the current element.
|
||||||
*
|
*
|
||||||
* When a step call [ignoreCurrentElement], no further steps are executed on the current
|
* When a step calls `ignoreCurrentElement`, no further steps are executed on the current
|
||||||
* element and no [CompileElement] is added to the result list.
|
* element and no `CompileElement` is added to the result list.
|
||||||
*/
|
*/
|
||||||
ignoreCurrentElement() {
|
ignoreCurrentElement() {
|
||||||
this._ignoreCurrentElement = true;
|
this._ignoreCurrentElement = true;
|
||||||
|
@ -26,7 +26,7 @@ export class CssSelector {
|
|||||||
static parse(selector:string): List<CssSelector> {
|
static parse(selector:string): List<CssSelector> {
|
||||||
var results = ListWrapper.create();
|
var results = ListWrapper.create();
|
||||||
var _addResult = (res, cssSel) => {
|
var _addResult = (res, cssSel) => {
|
||||||
if (isPresent(cssSel.notSelector) && isBlank(cssSel.element)
|
if (isPresent(cssSel.notSelector) && isBlank(cssSel.element)
|
||||||
&& ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
|
&& ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
|
||||||
cssSel.element = "*";
|
cssSel.element = "*";
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ export class SelectorMatcher {
|
|||||||
if (isBlank(map) || isBlank(name)) {
|
if (isBlank(map) || isBlank(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var selectables = MapWrapper.get(map, name);
|
var selectables = MapWrapper.get(map, name);
|
||||||
var starSelectables = MapWrapper.get(map, "*");
|
var starSelectables = MapWrapper.get(map, "*");
|
||||||
if (isPresent(starSelectables)) {
|
if (isPresent(starSelectables)) {
|
||||||
|
14
modules/angular2/src/test_lib/test_bed.js
vendored
14
modules/angular2/src/test_lib/test_bed.js
vendored
@ -30,7 +30,7 @@ export class TestBed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the [View] of a [Component].
|
* Overrides the {@link View} of a {@link Component}.
|
||||||
*
|
*
|
||||||
* @see setInlineTemplate() to only override the html
|
* @see setInlineTemplate() to only override the html
|
||||||
*
|
*
|
||||||
@ -42,8 +42,8 @@ export class TestBed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides only the html of a [Component].
|
* Overrides only the html of a {@link Component}.
|
||||||
* All the other propoerties of the component's [View] are preserved.
|
* All the other propoerties of the component's {@link View} are preserved.
|
||||||
*
|
*
|
||||||
* @param {Type} component
|
* @param {Type} component
|
||||||
* @param {string} html
|
* @param {string} html
|
||||||
@ -53,7 +53,7 @@ export class TestBed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides the directives from the component [View].
|
* Overrides the directives from the component {@link View}.
|
||||||
*
|
*
|
||||||
* @param {Type} component
|
* @param {Type} component
|
||||||
* @param {Type} from
|
* @param {Type} from
|
||||||
@ -64,7 +64,7 @@ export class TestBed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a [AppView] for the given component.
|
* Creates an `AppView` for the given component.
|
||||||
*
|
*
|
||||||
* Only either a component or a context needs to be specified but both can be provided for
|
* Only either a component or a context needs to be specified but both can be provided for
|
||||||
* advanced use cases (ie subclassing the context).
|
* advanced use cases (ie subclassing the context).
|
||||||
@ -109,7 +109,7 @@ export class TestBed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy to [AppView] return by [TestBed.createView] which offers a high level API for tests.
|
* Proxy to `AppView` return by `createView` in {@link TestBed} which offers a high level API for tests.
|
||||||
*/
|
*/
|
||||||
export class ViewProxy {
|
export class ViewProxy {
|
||||||
_view: AppView;
|
_view: AppView;
|
||||||
@ -142,7 +142,7 @@ export class ViewProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {AppView} return the underlying [AppView].
|
* @returns `AppView` returns the underlying `AppView`.
|
||||||
*
|
*
|
||||||
* Prefer using the other methods which hide implementation details.
|
* Prefer using the other methods which hide implementation details.
|
||||||
*/
|
*/
|
||||||
|
@ -25,7 +25,7 @@ Future<String> createNgSetters(AssetReader reader, AssetId entryPoint) async {
|
|||||||
|
|
||||||
// TODO(kegluneq): De-dupe from template_compiler/generator.dart.
|
// TODO(kegluneq): De-dupe from template_compiler/generator.dart.
|
||||||
|
|
||||||
/// Consumes the map generated by [_createBindMap] to codegen setters.
|
/// Consumes the map generated by {@link _createBindMap} to codegen setters.
|
||||||
List<String> _generateSetters(Map<String, String> bindMap) {
|
List<String> _generateSetters(Map<String, String> bindMap) {
|
||||||
var setters = [];
|
var setters = [];
|
||||||
// TODO(kegluneq): Include types for receivers. See #886.
|
// TODO(kegluneq): Include types for receivers. See #886.
|
||||||
@ -41,7 +41,7 @@ List<String> _generateSetters(Map<String, String> bindMap) {
|
|||||||
return setters;
|
return setters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Collapses all `bindProperties` in [ngDeps] into a map where the keys are
|
/// Collapses all `bindProperties` in {@link ngDeps} into a map where the keys are
|
||||||
/// the bind properties and the values are either the one and only type
|
/// the bind properties and the values are either the one and only type
|
||||||
/// binding to that property or the empty string.
|
/// binding to that property or the empty string.
|
||||||
Map<String, String> _createBindMap(NgDeps ngDeps) {
|
Map<String, String> _createBindMap(NgDeps ngDeps) {
|
||||||
|
@ -5,14 +5,14 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:barback/barback.dart';
|
import 'package:barback/barback.dart';
|
||||||
|
|
||||||
/// A class that allows fetching code using [AssetId]s without all the
|
/// A class that allows fetching code using {@link AssetId}s without all the
|
||||||
/// additional baggage of a [Transform].
|
/// additional baggage of a {@link Transform}.
|
||||||
abstract class AssetReader {
|
abstract class AssetReader {
|
||||||
Future<String> readAsString(AssetId id, {Encoding encoding});
|
Future<String> readAsString(AssetId id, {Encoding encoding});
|
||||||
Future<bool> hasInput(AssetId id);
|
Future<bool> hasInput(AssetId id);
|
||||||
|
|
||||||
/// Creates an [AssetReader] using the `transform`, which should be a
|
/// Creates an {@link AssetReader} using the `transform`, which should be a
|
||||||
/// [Transform] or [AggregateTransform].
|
/// {@link Transform} or {@link AggregateTransform}.
|
||||||
factory AssetReader.fromTransform(dynamic transform) =>
|
factory AssetReader.fromTransform(dynamic transform) =>
|
||||||
new _TransformAssetReader(transform);
|
new _TransformAssetReader(transform);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import 'package:angular2/src/transform/common/logging.dart';
|
|||||||
import 'package:barback/barback.dart';
|
import 'package:barback/barback.dart';
|
||||||
import 'package:code_transformers/assets.dart';
|
import 'package:code_transformers/assets.dart';
|
||||||
|
|
||||||
/// Creates a mapping of [AssetId]s to the [ClassDeclaration]s which they
|
/// Creates a mapping of {@link AssetId}s to the {@link ClassDeclaration}s which they
|
||||||
/// define.
|
/// define.
|
||||||
Future<Map<AssetId, List<ClassDeclaration>>> createTypeMap(
|
Future<Map<AssetId, List<ClassDeclaration>>> createTypeMap(
|
||||||
AssetReader reader, AssetId id) {
|
AssetReader reader, AssetId id) {
|
||||||
|
@ -7,12 +7,12 @@ import 'package:source_span/source_span.dart';
|
|||||||
|
|
||||||
BuildLogger _logger;
|
BuildLogger _logger;
|
||||||
|
|
||||||
/// Prepares [logger] for use throughout the transformer.
|
/// Prepares {@link logger} for use throughout the transformer.
|
||||||
void init(Transform t) {
|
void init(Transform t) {
|
||||||
_logger = new BuildLogger(t);
|
_logger = new BuildLogger(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets [logger] directly. Used for testing - in general use [init].
|
/// Sets {@link logger} directly. Used for testing - in general use {@link init}.
|
||||||
void setLogger(BuildLogger logger) {
|
void setLogger(BuildLogger logger) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ class TransformerOptions {
|
|||||||
/// The path to the files where the application's calls to `bootstrap` are.
|
/// The path to the files where the application's calls to `bootstrap` are.
|
||||||
final List<String> entryPoints;
|
final List<String> entryPoints;
|
||||||
|
|
||||||
/// The paths to the files where the application's [ReflectionCapabilities]
|
/// The paths to the files where the application's {@link ReflectionCapabilities}
|
||||||
/// are set.
|
/// are set.
|
||||||
final List<String> reflectionEntryPoints;
|
final List<String> reflectionEntryPoints;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ TransformerOptions parseBarbackSettings(BarbackSettings settings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Cribbed from the polymer project.
|
/// Cribbed from the polymer project.
|
||||||
/// [https://github.com/dart-lang/polymer-dart]
|
/// {@link https://github.com/dart-lang/polymer-dart}
|
||||||
List<String> _readFileList(Map config, String paramName) {
|
List<String> _readFileList(Map config, String paramName) {
|
||||||
var value = config[paramName];
|
var value = config[paramName];
|
||||||
if (value == null) return null;
|
if (value == null) return null;
|
||||||
|
@ -13,8 +13,8 @@ import 'registered_type.dart';
|
|||||||
|
|
||||||
export 'registered_type.dart';
|
export 'registered_type.dart';
|
||||||
|
|
||||||
/// A parser that reads `.ng_deps.dart` files (represented by [AssetId]s into
|
/// A parser that reads `.ng_deps.dart` files (represented by {@link AssetId}s into
|
||||||
/// easier to manage [NgDeps] files.
|
/// easier to manage {@link NgDeps} files.
|
||||||
class Parser {
|
class Parser {
|
||||||
final AssetReader _reader;
|
final AssetReader _reader;
|
||||||
final _ParseNgDepsVisitor _visitor = new _ParseNgDepsVisitor();
|
final _ParseNgDepsVisitor _visitor = new _ParseNgDepsVisitor();
|
||||||
@ -28,7 +28,7 @@ class Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Parses only the `.ng_deps.dart` file represented by `id`.
|
/// Parses only the `.ng_deps.dart` file represented by `id`.
|
||||||
/// See also [parseRecursive].
|
/// See also {@link parseRecursive}.
|
||||||
Future<NgDeps> parse(AssetId id) async {
|
Future<NgDeps> parse(AssetId id) async {
|
||||||
if (!(await _reader.hasInput(id))) return null;
|
if (!(await _reader.hasInput(id))) return null;
|
||||||
var ngDeps = new NgDeps(await _reader.readAsString(id));
|
var ngDeps = new NgDeps(await _reader.readAsString(id));
|
||||||
@ -37,9 +37,9 @@ class Parser {
|
|||||||
return ngDeps;
|
return ngDeps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses the `.ng_deps.dart` file represented by [id] into an [NgDeps]
|
/// Parses the `.ng_deps.dart` file represented by {@link id} into an {@link NgDeps}
|
||||||
/// object. All `.ng_deps.dart` files imported by [id] are then parsed. The
|
/// object. All `.ng_deps.dart` files imported by {@link id} are then parsed. The
|
||||||
/// results are added to [allDeps].
|
/// results are added to {@link allDeps}.
|
||||||
Future<List<NgDeps>> _recurse(AssetId id,
|
Future<List<NgDeps>> _recurse(AssetId id,
|
||||||
[List<NgDeps> allDeps, Set<AssetId> seen]) async {
|
[List<NgDeps> allDeps, Set<AssetId> seen]) async {
|
||||||
if (seen == null) seen = new Set<AssetId>();
|
if (seen == null) seen = new Set<AssetId>();
|
||||||
|
@ -5,7 +5,7 @@ import 'package:analyzer/src/generated/scanner.dart' show Keyword;
|
|||||||
/// Whether `name` is a valid property name.
|
/// Whether `name` is a valid property name.
|
||||||
bool isValid(String name) => !Keyword.keywords.containsKey(name);
|
bool isValid(String name) => !Keyword.keywords.containsKey(name);
|
||||||
|
|
||||||
/// Prepares [name] to be emitted inside a string.
|
/// Prepares `name` to be emitted inside a string.
|
||||||
String sanitize(String name) => name.replaceAll('\$', '\\\$');
|
String sanitize(String name) => name.replaceAll('\$', '\\\$');
|
||||||
|
|
||||||
/// Get a string usable as a lazy invalid setter, that is, one which will
|
/// Get a string usable as a lazy invalid setter, that is, one which will
|
||||||
|
@ -19,7 +19,7 @@ class RegisteredType {
|
|||||||
RegisteredType._(this.typeName, this.registerMethod, this.factoryFn,
|
RegisteredType._(this.typeName, this.registerMethod, this.factoryFn,
|
||||||
this.parameters, this.annotations);
|
this.parameters, this.annotations);
|
||||||
|
|
||||||
/// Creates a [RegisteredType] given a [MethodInvocation] node representing
|
/// Creates a {@link RegisteredType} given a {@link MethodInvocation} node representing
|
||||||
/// a call to `registerType`.
|
/// a call to `registerType`.
|
||||||
factory RegisteredType.fromMethodInvocation(MethodInvocation registerMethod) {
|
factory RegisteredType.fromMethodInvocation(MethodInvocation registerMethod) {
|
||||||
var visitor = new _ParseRegisterTypeVisitor();
|
var visitor = new _ParseRegisterTypeVisitor();
|
||||||
|
@ -56,7 +56,7 @@ bool _isNotDartDirective(UriBasedDirective directive) {
|
|||||||
return !stringLiteralToString(directive.uri).startsWith('dart:');
|
return !stringLiteralToString(directive.uri).startsWith('dart:');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Maps each input [UriBasedDirective] to its associated `.ng_deps.dart`
|
/// Maps each input {@link UriBasedDirective} to its associated `.ng_deps.dart`
|
||||||
/// file, if it exists.
|
/// file, if it exists.
|
||||||
Future<Map<UriBasedDirective, String>> _processNgImports(AssetReader reader,
|
Future<Map<UriBasedDirective, String>> _processNgImports(AssetReader reader,
|
||||||
AssetId entryPoint, Iterable<UriBasedDirective> directives) {
|
AssetId entryPoint, Iterable<UriBasedDirective> directives) {
|
||||||
|
@ -11,7 +11,7 @@ import 'package:barback/barback.dart';
|
|||||||
import 'linker.dart';
|
import 'linker.dart';
|
||||||
|
|
||||||
/// Transformer responsible for processing .ng_deps.dart files created by
|
/// Transformer responsible for processing .ng_deps.dart files created by
|
||||||
/// [DirectiveProcessor] and ensuring that the generated calls to
|
/// {@link DirectiveProcessor} and ensuring that the generated calls to
|
||||||
/// `setupReflection` call the necessary `setupReflection` method in all
|
/// `setupReflection` call the necessary `setupReflection` method in all
|
||||||
/// dependencies.
|
/// dependencies.
|
||||||
class DirectiveLinker extends Transformer {
|
class DirectiveLinker extends Transformer {
|
||||||
|
@ -19,7 +19,7 @@ import 'rewriter.dart';
|
|||||||
/// with @Component, @View, @Decorator, etc.
|
/// with @Component, @View, @Decorator, etc.
|
||||||
///
|
///
|
||||||
/// This transformer is the first phase in a two-phase transform. It should
|
/// This transformer is the first phase in a two-phase transform. It should
|
||||||
/// be followed by [DirectiveLinker].
|
/// be followed by {@link DirectiveLinker}.
|
||||||
class DirectiveProcessor extends Transformer {
|
class DirectiveProcessor extends Transformer {
|
||||||
final TransformerOptions options;
|
final TransformerOptions options;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import 'package:analyzer/analyzer.dart';
|
|||||||
import 'package:analyzer/src/generated/java_core.dart';
|
import 'package:analyzer/src/generated/java_core.dart';
|
||||||
import 'package:angular2/src/transform/common/logging.dart';
|
import 'package:angular2/src/transform/common/logging.dart';
|
||||||
|
|
||||||
/// `ToSourceVisitor` designed to accept [ConstructorDeclaration] nodes.
|
/// `ToSourceVisitor` designed to accept {@link ConstructorDeclaration} nodes.
|
||||||
class _CtorTransformVisitor extends ToSourceVisitor {
|
class _CtorTransformVisitor extends ToSourceVisitor {
|
||||||
bool _withParameterAnnotations = true;
|
bool _withParameterAnnotations = true;
|
||||||
bool _withParameterTypes = true;
|
bool _withParameterTypes = true;
|
||||||
@ -12,7 +12,7 @@ class _CtorTransformVisitor extends ToSourceVisitor {
|
|||||||
final PrintWriter writer;
|
final PrintWriter writer;
|
||||||
|
|
||||||
/// Maps field names to their declared types. This is populated whenever
|
/// Maps field names to their declared types. This is populated whenever
|
||||||
/// the listener visits a [ConstructorDeclaration] node.
|
/// the listener visits a {@link ConstructorDeclaration} node.
|
||||||
final Map<String, TypeName> _fieldNameToType = {};
|
final Map<String, TypeName> _fieldNameToType = {};
|
||||||
|
|
||||||
_CtorTransformVisitor(PrintWriter writer)
|
_CtorTransformVisitor(PrintWriter writer)
|
||||||
@ -39,8 +39,8 @@ class _CtorTransformVisitor extends ToSourceVisitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If [_withParameterTypes] is true, this method outputs [node]'s type. If
|
/// If `_withParameterTypes` is true, this method outputs `node`'s type. If
|
||||||
/// [_withParameterNames] is true, this method outputs [node]'s identifier.
|
/// `_withParameterNames` is true, this method outputs `node`'s identifier.
|
||||||
Object _visitNormalFormalParameter(
|
Object _visitNormalFormalParameter(
|
||||||
NodeList<Annotation> metadata, TypeName type, SimpleIdentifier name) {
|
NodeList<Annotation> metadata, TypeName type, SimpleIdentifier name) {
|
||||||
if (_withParameterAnnotations && metadata != null) {
|
if (_withParameterAnnotations && metadata != null) {
|
||||||
@ -144,7 +144,7 @@ class _CtorTransformVisitor extends ToSourceVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// ToSourceVisitor designed to print 'parameters' values for Angular2's
|
/// ToSourceVisitor designed to print 'parameters' values for Angular2's
|
||||||
/// [registerType] calls.
|
/// `registerType` calls.
|
||||||
class ParameterTransformVisitor extends _CtorTransformVisitor {
|
class ParameterTransformVisitor extends _CtorTransformVisitor {
|
||||||
ParameterTransformVisitor(PrintWriter writer) : super(writer) {
|
ParameterTransformVisitor(PrintWriter writer) : super(writer) {
|
||||||
_withParameterNames = false;
|
_withParameterNames = false;
|
||||||
@ -178,7 +178,7 @@ class ParameterTransformVisitor extends _CtorTransformVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// ToSourceVisitor designed to print 'factory' values for Angular2's
|
/// ToSourceVisitor designed to print 'factory' values for Angular2's
|
||||||
/// [registerType] calls.
|
/// `registerType` calls.
|
||||||
class FactoryTransformVisitor extends _CtorTransformVisitor {
|
class FactoryTransformVisitor extends _CtorTransformVisitor {
|
||||||
FactoryTransformVisitor(PrintWriter writer) : super(writer) {
|
FactoryTransformVisitor(PrintWriter writer) : super(writer) {
|
||||||
_withParameterAnnotations = false;
|
_withParameterAnnotations = false;
|
||||||
@ -200,8 +200,8 @@ class FactoryTransformVisitor extends _CtorTransformVisitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ToSourceVisitor designed to print a [ClassDeclaration] node as a
|
/// ToSourceVisitor designed to print a `ClassDeclaration` node as a
|
||||||
/// 'annotations' value for Angular2's [registerType] calls.
|
/// 'annotations' value for Angular2's `registerType` calls.
|
||||||
class AnnotationsTransformVisitor extends ToSourceVisitor {
|
class AnnotationsTransformVisitor extends ToSourceVisitor {
|
||||||
final PrintWriter writer;
|
final PrintWriter writer;
|
||||||
AnnotationsTransformVisitor(PrintWriter writer)
|
AnnotationsTransformVisitor(PrintWriter writer)
|
||||||
|
@ -4,7 +4,7 @@ import 'package:analyzer/src/generated/ast.dart';
|
|||||||
import 'package:analyzer/src/generated/element.dart';
|
import 'package:analyzer/src/generated/element.dart';
|
||||||
import 'package:angular2/src/transform/common/names.dart';
|
import 'package:angular2/src/transform/common/names.dart';
|
||||||
|
|
||||||
/// An object that checks for [ReflectionCapabilities] syntactically, that is,
|
/// An object that checks for {@link ReflectionCapabilities} syntactically, that is,
|
||||||
/// without resolution information.
|
/// without resolution information.
|
||||||
class AstTester {
|
class AstTester {
|
||||||
const AstTester();
|
const AstTester();
|
||||||
@ -17,7 +17,7 @@ class AstTester {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An object that checks for [ReflectionCapabilities] using a fully resolved
|
/// An object that checks for {@link ReflectionCapabilities} using a fully resolved
|
||||||
/// Ast.
|
/// Ast.
|
||||||
class ResolvedTester implements AstTester {
|
class ResolvedTester implements AstTester {
|
||||||
final ClassElement _forbiddenClass;
|
final ClassElement _forbiddenClass;
|
||||||
|
@ -25,7 +25,7 @@ class Codegen {
|
|||||||
/// Angular2 reflection statically.
|
/// Angular2 reflection statically.
|
||||||
///
|
///
|
||||||
/// The code generated here should follow the example of code generated for
|
/// The code generated here should follow the example of code generated for
|
||||||
/// an [ImportDirective] node.
|
/// an {@link ImportDirective} node.
|
||||||
String codegenImport() {
|
String codegenImport() {
|
||||||
var count = 0;
|
var count = 0;
|
||||||
return importUris
|
return importUris
|
||||||
@ -36,9 +36,9 @@ class Codegen {
|
|||||||
/// Generates code to call the method which sets up Angular2 reflection
|
/// Generates code to call the method which sets up Angular2 reflection
|
||||||
/// statically.
|
/// statically.
|
||||||
///
|
///
|
||||||
/// If [reflectorAssignment] is provided, it is expected to be the node
|
/// If `reflectorAssignment` is provided, it is expected to be the node
|
||||||
/// representing the [ReflectionCapabilities] assignment, and we will
|
/// representing the {@link ReflectionCapabilities} assignment, and we will
|
||||||
/// attempt to parse the access of [reflector] from it so that [reflector] is
|
/// attempt to parse the access of `reflector` from it so that `reflector` is
|
||||||
/// properly prefixed if necessary.
|
/// properly prefixed if necessary.
|
||||||
String codegenSetupReflectionCall(
|
String codegenSetupReflectionCall(
|
||||||
{AssignmentExpression reflectorAssignment}) {
|
{AssignmentExpression reflectorAssignment}) {
|
||||||
@ -58,7 +58,7 @@ class Codegen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A visitor whose job it is to find the access of [reflector].
|
/// A visitor whose job it is to find the access of `reflector`.
|
||||||
class _ReflectorVisitor extends Object with SimpleAstVisitor<Expression> {
|
class _ReflectorVisitor extends Object with SimpleAstVisitor<Expression> {
|
||||||
@override
|
@override
|
||||||
Expression visitAssignmentExpression(AssignmentExpression node) {
|
Expression visitAssignmentExpression(AssignmentExpression node) {
|
||||||
|
@ -9,10 +9,10 @@ import 'codegen.dart';
|
|||||||
import 'rewriter.dart';
|
import 'rewriter.dart';
|
||||||
|
|
||||||
/// Finds the call to the Angular2 `ReflectionCapabilities` constructor
|
/// Finds the call to the Angular2 `ReflectionCapabilities` constructor
|
||||||
/// in [reflectionEntryPoint] and replaces it with a call to
|
/// in `reflectionEntryPoint` and replaces it with a call to
|
||||||
/// `setupReflection` in [newEntryPoint].
|
/// `setupReflection` in `newEntryPoint`.
|
||||||
///
|
///
|
||||||
/// This only searches the code in [reflectionEntryPoint], not `part`s,
|
/// This only searches the code in `reflectionEntryPoint`, not `part`s,
|
||||||
/// `import`s, `export`s, etc.
|
/// `import`s, `export`s, etc.
|
||||||
Future<String> removeReflectionCapabilities(AssetReader reader,
|
Future<String> removeReflectionCapabilities(AssetReader reader,
|
||||||
AssetId reflectionEntryPoint, Iterable<AssetId> newEntryPoints) async {
|
AssetId reflectionEntryPoint, Iterable<AssetId> newEntryPoints) async {
|
||||||
|
@ -16,9 +16,9 @@ class Rewriter {
|
|||||||
: _tester = tester == null ? const AstTester() : tester;
|
: _tester = tester == null ? const AstTester() : tester;
|
||||||
|
|
||||||
/// Rewrites the provided code removing imports of the
|
/// Rewrites the provided code removing imports of the
|
||||||
/// [ReflectionCapabilities] library and instantiations of
|
/// {@link ReflectionCapabilities} library and instantiations of
|
||||||
/// [ReflectionCapabilities], as detected by the (potentially) provided
|
/// {@link ReflectionCapabilities}, as detected by the (potentially) provided
|
||||||
/// [AstTester].
|
/// {@link AstTester}.
|
||||||
///
|
///
|
||||||
/// To the extent possible, this method does not change line numbers or
|
/// To the extent possible, this method does not change line numbers or
|
||||||
/// offsets in the provided code to facilitate debugging via source maps.
|
/// offsets in the provided code to facilitate debugging via source maps.
|
||||||
@ -86,7 +86,7 @@ class Rewriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Visitor responsible for rewriting the Angular 2 code which instantiates
|
/// Visitor responsible for rewriting the Angular 2 code which instantiates
|
||||||
/// [ReflectionCapabilities] and removing its associated import.
|
/// {@link ReflectionCapabilities} and removing its associated import.
|
||||||
///
|
///
|
||||||
/// This breaks our dependency on dart:mirrors, which enables smaller code
|
/// This breaks our dependency on dart:mirrors, which enables smaller code
|
||||||
/// size and better performance.
|
/// size and better performance.
|
||||||
|
@ -10,13 +10,13 @@ import 'package:barback/barback.dart';
|
|||||||
import 'remove_reflection_capabilities.dart';
|
import 'remove_reflection_capabilities.dart';
|
||||||
|
|
||||||
/// Transformer responsible for removing the import and instantiation of
|
/// Transformer responsible for removing the import and instantiation of
|
||||||
/// [ReflectionCapabilities].
|
/// {@link ReflectionCapabilities}.
|
||||||
///
|
///
|
||||||
/// The goal of this is to break the app's dependency on dart:mirrors.
|
/// The goal of this is to break the app's dependency on dart:mirrors.
|
||||||
///
|
///
|
||||||
/// This transformer assumes that [DirectiveProcessor] and [DirectiveLinker]
|
/// This transformer assumes that {@link DirectiveProcessor} and {@link DirectiveLinker}
|
||||||
/// have already been run and that a .ng_deps.dart file has been generated for
|
/// have already been run and that a .ng_deps.dart file has been generated for
|
||||||
/// [options.entryPoint]. The instantiation of [ReflectionCapabilities] is
|
/// {@link options.entryPoint}. The instantiation of {@link ReflectionCapabilities} is
|
||||||
/// replaced by calling `setupReflection` in that .ng_deps.dart file.
|
/// replaced by calling `setupReflection` in that .ng_deps.dart file.
|
||||||
class ReflectionRemover extends Transformer {
|
class ReflectionRemover extends Transformer {
|
||||||
final TransformerOptions options;
|
final TransformerOptions options;
|
||||||
|
@ -26,7 +26,7 @@ import 'recording_reflection_capabilities.dart';
|
|||||||
/// Angular 2 `View` annotations it declares to generate `getter`s,
|
/// Angular 2 `View` annotations it declares to generate `getter`s,
|
||||||
/// `setter`s, and `method`s that would otherwise be reflectively accessed.
|
/// `setter`s, and `method`s that would otherwise be reflectively accessed.
|
||||||
///
|
///
|
||||||
/// This method assumes a [DomAdapter] has been registered.
|
/// This method assumes a {@link DomAdapter} has been registered.
|
||||||
Future<String> processTemplates(AssetReader reader, AssetId entryPoint) async {
|
Future<String> processTemplates(AssetReader reader, AssetId entryPoint) async {
|
||||||
var parser = new Parser(reader);
|
var parser = new Parser(reader);
|
||||||
NgDeps ngDeps = await parser.parse(entryPoint);
|
NgDeps ngDeps = await parser.parse(entryPoint);
|
||||||
@ -163,7 +163,7 @@ class _TemplateExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Visitor responsible for processing the `annotations` property of a
|
/// Visitor responsible for processing the `annotations` property of a
|
||||||
/// [RegisterType] object and pulling out template text.
|
/// {@link RegisterType} object and pulling out template text.
|
||||||
class _TemplateExtractVisitor extends Object with RecursiveAstVisitor<Object> {
|
class _TemplateExtractVisitor extends Object with RecursiveAstVisitor<Object> {
|
||||||
final List<String> inlineValues = [];
|
final List<String> inlineValues = [];
|
||||||
final List<String> urlValues = [];
|
final List<String> urlValues = [];
|
||||||
|
@ -12,9 +12,9 @@ import 'package:barback/barback.dart';
|
|||||||
|
|
||||||
import 'generator.dart';
|
import 'generator.dart';
|
||||||
|
|
||||||
/// [Transformer] responsible for detecting and processing Angular 2 templates.
|
/// {@link Transformer} responsible for detecting and processing Angular 2 templates.
|
||||||
///
|
///
|
||||||
/// [TemplateCompiler] uses the Angular 2 `Compiler` to process the templates,
|
/// {@link TemplateCompiler} uses the Angular 2 `Compiler` to process the templates,
|
||||||
/// extracting information about what reflection is necessary to render and
|
/// extracting information about what reflection is necessary to render and
|
||||||
/// use that template. It then generates code in place of those reflective
|
/// use that template. It then generates code in place of those reflective
|
||||||
/// accesses.
|
/// accesses.
|
||||||
|
@ -5,7 +5,7 @@ library angular2.test.transform;
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
/// Mocked out version of [bootstrap], defined in application.dart. Importing
|
/// Mocked out version of `bootstrap`, defined in application.dart. Importing
|
||||||
/// the actual file in tests causes issues with resolution due to its
|
/// the actual file in tests causes issues with resolution due to its
|
||||||
/// transitive dependencies.
|
/// transitive dependencies.
|
||||||
Future bootstrap(Type appComponentType,
|
Future bootstrap(Type appComponentType,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// BSD-style license that can be found in the LICENSE file.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
library angular2.test.transform;
|
library angular2.test.transform;
|
||||||
|
|
||||||
/// Mocked out version of [ReflectionCapabilities], defined in
|
/// Mocked out version of {@link ReflectionCapabilities}, defined in
|
||||||
/// src/reflection/reflection_capabilities.dart. Importing the actual file in
|
/// src/reflection/reflection_capabilities.dart. Importing the actual file in
|
||||||
/// tests causes issues with resolution due to transitive dependencies.
|
/// tests causes issues with resolution due to transitive dependencies.
|
||||||
class ReflectionCapabilities {}
|
class ReflectionCapabilities {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user