parent
64ad74acbe
commit
5c25248582
|
@ -2,6 +2,6 @@
|
|||
* @module
|
||||
* @public
|
||||
* @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,6 +2,6 @@
|
|||
* @module
|
||||
* @public
|
||||
* @description
|
||||
* Errors thrown by the [Injector].
|
||||
* Errors thrown by the {@link Injector}.
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* @module
|
||||
* @public
|
||||
* @description
|
||||
* This module is used for handling user input, by defining and building a [FormObject] that consists of [Control]
|
||||
* objects, and mapping them onto the DOM. [Control] objects can then be used to read information from the form DOM
|
||||
* elements.
|
||||
* This module is used for handling user input, by defining and building a {@link ControlGroup} that consists of
|
||||
* {@link Control} objects, and mapping them onto the DOM. {@link Control} objects can then be used to read information
|
||||
* from the form DOM elements.
|
||||
*
|
||||
* 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
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* [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.
|
||||
*
|
||||
* @exportedAs angular2/change_detection
|
||||
|
@ -42,4 +42,4 @@ export class ChangeDetectorRef {
|
|||
this._cd.mode = CHECK_ALWAYS;
|
||||
this.requestCheck();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,17 +14,17 @@ export class ProtoChangeDetector {
|
|||
*
|
||||
* Angular implements the following change detection strategies by default:
|
||||
*
|
||||
* - [dynamicChangeDetection]: slower, but does not require `eval()`.
|
||||
* - [jitChangeDetection]: faster, but requires `eval()`.
|
||||
* - {@link DynamicChangeDetection}: slower, but does not require `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.
|
||||
*
|
||||
* In Dart, use `dynamicChangeDetection` during development. The Angular transformer generates an analog to the
|
||||
* `jitChangeDetection` strategy at compile time.
|
||||
* In Dart, use `DynamicChangeDetection` during development. The Angular transformer generates an analog to the
|
||||
* `JitChangeDetection` strategy at compile time.
|
||||
*
|
||||
*
|
||||
* See: [dynamicChangeDetection], [jitChangeDetection]
|
||||
* See: {@link DynamicChangeDetection}, {@link JitChangeDetection}
|
||||
*
|
||||
* # Example
|
||||
* ```javascript
|
||||
|
|
|
@ -210,10 +210,10 @@ export class IterableChanges extends Pipe {
|
|||
/**
|
||||
* 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] is the current item in the collection
|
||||
* - [index] is the position of the item in the collection
|
||||
* - `item` is the current item in the collection
|
||||
* - `index` is the position of the item in the collection
|
||||
*/
|
||||
_mismatch(record:CollectionChangeRecord, item, index:int):CollectionChangeRecord {
|
||||
// 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) {
|
||||
// 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.
|
||||
*/
|
||||
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
|
|
|
@ -8,32 +8,32 @@ import {DEFAULT} from 'angular2/change_detection';
|
|||
/**
|
||||
* Directives allow you to attach behavior to elements in the DOM.
|
||||
*
|
||||
* Directive is an abstract concept, instead use concrete directives: [Component], [DynamicComponent], [Decorator]
|
||||
* or [Viewport].
|
||||
* Directive is an abstract concept, instead use concrete directives: {@link Component}, {@link DynamicComponent}, {@link Decorator}
|
||||
* 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:
|
||||
*
|
||||
* 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,
|
||||
* 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,
|
||||
* as declared in the HTML.
|
||||
*
|
||||
* ## Understanding How Injection Works
|
||||
*
|
||||
* There are three stages of injection resolution.
|
||||
* - *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`.
|
||||
* - 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.
|
||||
* - *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.
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* To inject other directives, declare the constructor parameter as:
|
||||
* - `directive:DirectiveType`: a directive on the current element only
|
||||
* - `@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.
|
||||
* - `@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].
|
||||
* - `@Descendants query:Query<DirectiveType>`: A live collection of any 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 (will be implemented in later relaese).
|
||||
*
|
||||
* To inject element-specific special objects, declare the constructor parameter as:
|
||||
* - `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.
|
||||
*
|
||||
* ## Example
|
||||
|
@ -184,32 +184,35 @@ import {DEFAULT} from 'angular2/change_detection';
|
|||
* `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
|
||||
* directives, a directive can't simply inject the list of child directives. Instead, the directive asynchronously
|
||||
* injects a [Query], which updates as children are added, removed, or moved by any [ViewPort] directive such as a
|
||||
* `for`, an `if`, or a `switch`.
|
||||
* directives, a directive can't simply inject the list of child directives. Instead, the directive
|
||||
* injects a {@link QueryList}, which updates its contents as children are added, removed, or moved by any
|
||||
* {@link Viewport} directive such as a `for`, an `if`, or a `switch`.
|
||||
*
|
||||
* ```
|
||||
* @Decorator({ selector: '[my-directive]' })
|
||||
* 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
|
||||
* not be included, because it is not a direct child.
|
||||
* This directive would be instantiated with a {@link QueryList} which contains `Dependency` 4 and 6. Here, `Dependency`
|
||||
* 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.
|
||||
*
|
||||
* ```
|
||||
* @Decorator({ selector: '[my-directive]' })
|
||||
* 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.
|
||||
* - `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.
|
||||
*
|
||||
*
|
||||
|
@ -333,7 +336,9 @@ export class Directive extends Injectable {
|
|||
* 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
|
||||
* 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({
|
||||
|
@ -399,7 +404,7 @@ export class Directive extends Injectable {
|
|||
* When writing a directive event binding, you can also refer to the following local variables:
|
||||
* - `$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.
|
||||
* [TO BE IMPLEMENTED]
|
||||
* (will be implemented in later release)
|
||||
*
|
||||
*
|
||||
* ## Syntax
|
||||
|
@ -443,7 +448,7 @@ export class Directive extends Injectable {
|
|||
/**
|
||||
* 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>
|
||||
|
||||
|
@ -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 {
|
||||
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
|
||||
* - creates a shadow DOM for the component.
|
||||
* - 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.
|
||||
*
|
||||
* For details on the `@View` annotation, see [View].
|
||||
* For details on the `@View` annotation, see {@link View}.
|
||||
*
|
||||
* ## 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* are children in the component's light DOM.
|
||||
*
|
||||
*
|
||||
* The syntax for configuring the [injectables] injectable is identical to [Injector] injectable configuration. See
|
||||
* [Injector] for additional detail.
|
||||
* The syntax for configuring the `injectables` injectable is identical to {@link Injector} injectable configuration.
|
||||
* See {@link Injector} for additional detail.
|
||||
*
|
||||
*
|
||||
* ## Simple Example
|
||||
|
@ -656,7 +661,7 @@ export class Component extends Directive {
|
|||
*/
|
||||
export class DynamicComponent extends Directive {
|
||||
/**
|
||||
* Same as [Component.injectables].
|
||||
* Same as `injectables` in the {@link Component}.
|
||||
*/
|
||||
// TODO(vsankin): Please extract into AbstractComponent
|
||||
injectables:any; //List;
|
||||
|
@ -696,10 +701,10 @@ export class DynamicComponent extends Directive {
|
|||
* (see: http://en.wikipedia.org/wiki/Composition_over_inheritance)
|
||||
*
|
||||
* Decorators:
|
||||
* - are simplest form of [Directive]s.
|
||||
* - are simplest form of {@link Directive}s.
|
||||
* - 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
|
||||
* - do not create their own evaluation context
|
||||
* - 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.
|
||||
*
|
||||
* A viewport directive uses a [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
|
||||
* A viewport directive uses a {@link ViewContainer} to instantiate, insert, move, and destroy views at runtime.
|
||||
* The {@link ViewContainer} is created as a result of `<template>` element, and represents a location in the current view
|
||||
* 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.
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Notify a directive whenever a [View] that contains it is destroyed.
|
||||
* Notify a directive whenever a {@link View} that contains it is destroyed.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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
|
||||
* 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
|
||||
* 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
|
||||
*
|
||||
|
@ -34,21 +34,21 @@ import {ABSTRACT, CONST, Type} from 'angular2/src/facade/lang';
|
|||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
|
|
@ -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
|
||||
* `injectables`. Optionally, you can also override the injector configuration for an app by invoking
|
||||
* `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.
|
||||
* 5. It instantiates the specified component.
|
||||
* 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
|
||||
* 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."
|
||||
*
|
||||
*
|
||||
|
@ -238,13 +238,13 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
|
|||
*
|
||||
*
|
||||
* # 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(...)`.
|
||||
* - [componentInjectableBindings]: An additional set of bindings that can be added to the [Component.injectables] to
|
||||
* override default injection behavior.
|
||||
* - [errorReporter]: `function(exception:any, stackTrace:string)` a default error reporter for unhandled exceptions.
|
||||
* - `componentInjectableBindings`: An additional set of bindings that can be added to `injectables` for the
|
||||
* {@link Component} to override default injection behavior.
|
||||
* - `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
|
||||
*/
|
||||
|
|
|
@ -80,4 +80,4 @@ export class QueryList extends BaseQueryList {
|
|||
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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Each Angular application has a single `LifeCycle` instance.
|
||||
*
|
||||
* # 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.
|
||||
*
|
||||
* ```javascript
|
||||
|
|
|
@ -4,19 +4,19 @@ import 'dart:async' as async;
|
|||
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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* in the "inner" zone unless [runOutsideAngular] is explicitely called.
|
||||
* The wrapper maintains an "inner" and "outer" `Zone`. The application code will executes
|
||||
* in the "inner" zone unless `runOutsideAngular` is explicitely called.
|
||||
*
|
||||
* A typical application will create a singleton [VmTurnZone] whose outer [Zone] is the root [Zone]
|
||||
* and whose default [onTurnDone] runs the Angular digest.
|
||||
* A typical application will create a singleton `VmTurnZone` whose outer `Zone` is the root `Zone`
|
||||
* and whose default `onTurnDone` runs the Angular digest.
|
||||
*/
|
||||
class VmTurnZone {
|
||||
Function _onTurnStart;
|
||||
|
@ -32,8 +32,8 @@ class VmTurnZone {
|
|||
/**
|
||||
* Associates with this
|
||||
*
|
||||
* - an "outer" [Zone], which is the one that created this.
|
||||
* - an "inner" [Zone], which is a child of the outer [Zone].
|
||||
* - an "outer" `Zone`, which is the one that created this.
|
||||
* - an "inner" `Zone`, which is a child of the outer `Zone`.
|
||||
*
|
||||
* @param {bool} enableLongStackTrace whether to enable long stack trace. They should only be
|
||||
* 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
|
||||
* Angular's auto digest mechanism.
|
||||
|
@ -78,7 +78,7 @@ class VmTurnZone {
|
|||
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
|
||||
* 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.
|
||||
*
|
||||
* The wrapper maintains an "inner" and "outer" [Zone]. The application code will executes
|
||||
* in the "inner" zone unless [runOutsideAngular] is explicitely called.
|
||||
* The wrapper maintains an "inner" and "outer" `Zone`. The application code will executes
|
||||
* in the "inner" zone unless `runOutsideAngular` is explicitely called.
|
||||
*
|
||||
* A typical application will create a singleton [VmTurnZone] whose outer [Zone] is the root [Zone]
|
||||
* and whose default [onTurnDone] runs the Angular digest.
|
||||
* A typical application will create a singleton `VmTurnZone` whose outer `Zone` is the root `Zone`
|
||||
* and whose default `onTurnDone` runs the Angular digest.
|
||||
*
|
||||
* @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
|
||||
* 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
|
||||
* auto-digest mechanism.
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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.
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* class AComponent {
|
||||
* constructor(@Optional() aService:MyService) {
|
||||
|
|
|
@ -31,9 +31,9 @@ export class Dependency {
|
|||
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
|
||||
*
|
||||
|
@ -50,7 +50,7 @@ var _EMPTY_LIST = []; // TODO: make const when supported
|
|||
export class Binding {
|
||||
|
||||
/**
|
||||
* Token used when retrieving this binding. Usually the [Type].
|
||||
* Token used when retrieving this binding. Usually the `Type`.
|
||||
*/
|
||||
token;
|
||||
|
||||
|
@ -103,7 +103,7 @@ export class Binding {
|
|||
/**
|
||||
* 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.
|
||||
*
|
||||
* ## 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
|
||||
* 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
|
||||
* [Injector.asyncGet] API.
|
||||
* `asyncGet` API in the {@link Injector}.
|
||||
*
|
||||
*/
|
||||
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 {
|
||||
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
|
||||
* methods, as [Injector] only operates on calling factory functions.
|
||||
* A {@link Binding} is resolved when it has a factory function. Binding to a class, alias, or value, are just convenience
|
||||
* methods, as {@link Injector} only operates on calling factory functions.
|
||||
*
|
||||
* @exportedAs angular2/di
|
||||
*/
|
||||
export class ResolvedBinding {
|
||||
/**
|
||||
* A key, usually a [Type].
|
||||
* A key, usually a `Type`.
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* Arguments (dependencies) to the [factory] function.
|
||||
* Arguments (dependencies) to the `factory` function.
|
||||
*/
|
||||
dependencies:List<Dependency>;
|
||||
|
||||
/**
|
||||
* Specifies whether the [factory] function returns a [Promise].
|
||||
* Specifies whether the `factory` function returns a `Promise`.
|
||||
*/
|
||||
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}.
|
||||
*
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -446,9 +446,9 @@ export class BindingBuilder {
|
|||
* ```
|
||||
*
|
||||
* 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
|
||||
* [Injector.asyncGet] API.
|
||||
* the `asyncGet` API in the {@link Injector}.
|
||||
*/
|
||||
toAsyncFactory(factoryFunction:Function, dependencies:List = null):Binding {
|
||||
return new Binding(this.token, {
|
||||
|
|
|
@ -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]
|
||||
* for [Key].
|
||||
* Thrown when trying to retrieve a dependency by `Key` from {@link Injector}, but the {@link Injector} does not have a
|
||||
* {@link Binding} for {@link Key}.
|
||||
*
|
||||
* @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
|
||||
*
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -170,7 +170,7 @@ export class InvalidBindingError extends Error {
|
|||
/**
|
||||
* 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.
|
||||
*
|
||||
* @exportedAs angular2/di_errors
|
||||
|
|
|
@ -70,14 +70,15 @@ export class Injector {
|
|||
* 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
|
||||
* list of [ResolvedBinding]s. The resolution can be cached by [Injector.resolve] for performance-sensitive
|
||||
* code.
|
||||
* list of {@link ResolvedBinding}s. The resolution can be cached by `resolve` for the {@link Injector} for
|
||||
* 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
|
||||
* passing it to [Injector] functions that require resolved binding lists, such as [fromResolvedBindings] and
|
||||
* [createChildFromResolved].
|
||||
* The returned list is sparse, indexed by `id` for the {@link Key}. It is generally not useful to application code
|
||||
* other than for passing it to {@link Injector} functions that require resolved binding lists, such as
|
||||
* `fromResolvedBindings` and `createChildFromResolved`.
|
||||
*/
|
||||
static resolve(bindings:List/*<ResolvedBinding|Binding|Type|List>*/):List<ResolvedBinding> {
|
||||
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
|
||||
* 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 [defaultBindings] Setting to true will auto-create bindings.
|
||||
* @param `bindings` can be a list of `Type`, {@link Binding}, {@link ResolvedBinding}, or a recursive list of more
|
||||
* bindings.
|
||||
* @param `defaultBindings` Setting to true will auto-create bindings.
|
||||
*/
|
||||
static resolveAndCreate(bindings:List/*<ResolvedBinding|Binding|Type|List>*/, {defaultBindings=false}={}) {
|
||||
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
|
||||
* recommended way to construct injectors in performance-sensitive parts.
|
||||
*
|
||||
* @param [bindings] A sparse list of [ResolvedBinding]s. See [Injector.resolve].
|
||||
* @param [defaultBindings] Setting to true will auto-create bindings.
|
||||
* @param `bindings` A sparse list of {@link ResolvedBinding}s. See `resolve` for the {@link Injector}.
|
||||
* @param `defaultBindings` Setting to true will auto-create bindings.
|
||||
*/
|
||||
static fromResolvedBindings(bindings:List<ResolvedBinding>, {defaultBindings=false}={}) {
|
||||
return new Injector(bindings, null, defaultBindings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param [bindings] A sparse list of [ResolvedBinding]s. See [Injector.resolve].
|
||||
* @param [parent] Parent Injector or `null` if root injector.
|
||||
* @param [defaultBindings] Setting to true will auto-create bindings. (Only use with root injector.)
|
||||
* @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 `defaultBindings` Setting to true will auto-create bindings. (Only use with root injector.)
|
||||
*/
|
||||
constructor(bindings:List<ResolvedBinding>, parent:Injector, defaultBindings:boolean) {
|
||||
this._bindings = bindings;
|
||||
|
@ -126,7 +129,7 @@ export class 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.
|
||||
*/
|
||||
get(token) {
|
||||
|
@ -138,7 +141,7 @@ export class 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.
|
||||
*/
|
||||
getOptional(token) {
|
||||
|
@ -148,8 +151,8 @@ export class Injector {
|
|||
/**
|
||||
* 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).
|
||||
* @returns a [Promise] which resolves to the instance represented by the token.
|
||||
* @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.
|
||||
*/
|
||||
asyncGet(token):Promise {
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
* code.
|
||||
* list of {@link ResolvedBinding}s. The resolution can be cached by `resolve` for the {@link Injector} for
|
||||
* 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 {
|
||||
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].
|
||||
* @returns a new child `Injector`.
|
||||
* @param `bindings`: A sparse list of {@link ResolvedBinding}s. See `resolve` for the {@link Injector}.
|
||||
* @returns a new child {@link Injector}.
|
||||
*/
|
||||
createChildFromResolved(bindings:List<ResolvedBinding>):Injector {
|
||||
return new Injector(bindings, this, false);
|
||||
|
|
|
@ -4,13 +4,13 @@ import {MapWrapper} from 'angular2/src/facade/collection';
|
|||
// 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:
|
||||
* - a system-wide unique [id].
|
||||
* - a [token], usually the [Type] of the instance.
|
||||
* Keys have:
|
||||
* - a system-wide unique `id`.
|
||||
* - 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.
|
||||
*
|
||||
* @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 {
|
||||
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 */ {
|
||||
return _globalKeyRegistry.numberOfKeys;
|
||||
|
|
|
@ -200,7 +200,7 @@ class Html5LibDomAdapter implements DomAdapter {
|
|||
String tagName(element) => element.localName;
|
||||
|
||||
attributeMap(element) {
|
||||
// `attributes` keys can be [AttributeName]s.
|
||||
// `attributes` keys can be {@link AttributeName}s.
|
||||
var map = <String, String>{};
|
||||
element.attributes.forEach((key, value) {
|
||||
map['$key'] = value;
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
@ -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
|
||||
* 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.
|
||||
*
|
||||
* ```
|
||||
|
@ -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
|
||||
* 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.
|
||||
*
|
||||
* ```
|
||||
|
|
|
@ -8,8 +8,8 @@ import * as modelModule from './model';
|
|||
*
|
||||
* # Example
|
||||
*
|
||||
* This example creates a [ControlGroup] that consists of a `login` [Control], and a nested [ControlGroup] that defines
|
||||
* a `password` and a `passwordConfirmation` [Control].
|
||||
* This example creates a {@link ControlGroup} that consists of a `login` {@link Control}, and a nested
|
||||
* {@link ControlGroup} that defines a `password` and a `passwordConfirmation` {@link Control}.
|
||||
*
|
||||
* ```
|
||||
* var loginForm = builder.group({
|
||||
|
|
|
@ -89,8 +89,8 @@ export class AbstractControl {
|
|||
/**
|
||||
* 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]
|
||||
* and [ControlArray].
|
||||
* `Control` is one of the three fundamental building blocks used to define forms in Angular, along with
|
||||
* {@link ControlGroup} and {@link ControlArray}.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* A ControlGroup aggregates the values and errors of each [Control] in the group. Thus, if one of the controls in a
|
||||
* group is invalid, the entire group is invalid. Similarly, if a control changes its value, the entire group changes
|
||||
* as well.
|
||||
* A ControlGroup aggregates the values and errors of each {@link Control} in the group. Thus, if one of the controls
|
||||
* in a group is invalid, the entire group is invalid. Similarly, if a control changes its value, the entire group
|
||||
* changes as well.
|
||||
*
|
||||
* `ControlGroup` is one of the three fundamental building blocks used to define forms in Angular, along with [Control]
|
||||
* and [ControlArray]. [ControlArray] can also contain other controls, but is of variable length.
|
||||
* `ControlGroup` is one of the three fundamental building blocks used to define forms in Angular, along with
|
||||
* {@link Control} and {@link ControlArray}. {@link ControlArray} can also contain other controls, but is of variable
|
||||
* length.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* A `ControlArray` aggregates the values and errors of each [Control] in the group. Thus, if one of the controls in a
|
||||
* group is invalid, the entire group is invalid. Similarly, if a control changes its value, the entire group changes
|
||||
* as well.
|
||||
* A `ControlArray` aggregates the values and errors of each {@link Control} in the group. Thus, if one of the controls
|
||||
* in a group is invalid, the entire group is invalid. Similarly, if a control changes its value, the entire group
|
||||
* changes as well.
|
||||
*
|
||||
* `ControlArray` is one of the three fundamental building blocks used to define forms in Angular, along with [Control]
|
||||
* and [ControlGroup]. [ControlGroup] can also contain other controls, but is of fixed length.
|
||||
* `ControlArray` is one of the three fundamental building blocks used to define forms in Angular, along with
|
||||
* {@link Control} and {@link ControlGroup}. {@link ControlGroup} can also contain other controls, but is of fixed
|
||||
* length.
|
||||
*
|
||||
* @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 {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} from
|
||||
|
@ -61,11 +61,11 @@ export class MockTemplateResolver extends TemplateResolver {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the [View] for a component:
|
||||
* - Set the [View] to the overridden template when it exists or fallback to the default
|
||||
* [TemplateResolver], see [setView]
|
||||
* - Override the directives, see [overrideTemplateDirective]
|
||||
* - Override the @View definition, see [setInlineTemplate]
|
||||
* Returns the {@link View} for a component:
|
||||
* - Set the {@link View} to the overridden template when it exists or fallback to the default `TemplateResolver`,
|
||||
* see `setView`.
|
||||
* - Override the directives, see `overrideTemplateDirective`.
|
||||
* - Override the @View definition, see `setInlineTemplate`.
|
||||
*
|
||||
* @param component
|
||||
* @returns {ViewDefinition}
|
||||
|
|
|
@ -68,8 +68,8 @@ export class CompileControl {
|
|||
/**
|
||||
* Ignores the current element.
|
||||
*
|
||||
* When a step call [ignoreCurrentElement], no further steps are executed on the current
|
||||
* element and no [CompileElement] is added to the result list.
|
||||
* When a step calls `ignoreCurrentElement`, no further steps are executed on the current
|
||||
* element and no `CompileElement` is added to the result list.
|
||||
*/
|
||||
ignoreCurrentElement() {
|
||||
this._ignoreCurrentElement = true;
|
||||
|
|
|
@ -26,7 +26,7 @@ export class CssSelector {
|
|||
static parse(selector:string): List<CssSelector> {
|
||||
var results = ListWrapper.create();
|
||||
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)) {
|
||||
cssSel.element = "*";
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ export class SelectorMatcher {
|
|||
if (isBlank(map) || isBlank(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var selectables = MapWrapper.get(map, name);
|
||||
var starSelectables = MapWrapper.get(map, "*");
|
||||
if (isPresent(starSelectables)) {
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
@ -42,8 +42,8 @@ export class TestBed {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides only the html of a [Component].
|
||||
* All the other propoerties of the component's [View] are preserved.
|
||||
* Overrides only the html of a {@link Component}.
|
||||
* All the other propoerties of the component's {@link View} are preserved.
|
||||
*
|
||||
* @param {Type} component
|
||||
* @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} 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
|
||||
* 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 {
|
||||
_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.
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,7 @@ Future<String> createNgSetters(AssetReader reader, AssetId entryPoint) async {
|
|||
|
||||
// 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) {
|
||||
var setters = [];
|
||||
// TODO(kegluneq): Include types for receivers. See #886.
|
||||
|
@ -41,7 +41,7 @@ List<String> _generateSetters(Map<String, String> bindMap) {
|
|||
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
|
||||
/// binding to that property or the empty string.
|
||||
Map<String, String> _createBindMap(NgDeps ngDeps) {
|
||||
|
|
|
@ -5,14 +5,14 @@ import 'dart:convert';
|
|||
|
||||
import 'package:barback/barback.dart';
|
||||
|
||||
/// A class that allows fetching code using [AssetId]s without all the
|
||||
/// additional baggage of a [Transform].
|
||||
/// A class that allows fetching code using {@link AssetId}s without all the
|
||||
/// additional baggage of a {@link Transform}.
|
||||
abstract class AssetReader {
|
||||
Future<String> readAsString(AssetId id, {Encoding encoding});
|
||||
Future<bool> hasInput(AssetId id);
|
||||
|
||||
/// Creates an [AssetReader] using the `transform`, which should be a
|
||||
/// [Transform] or [AggregateTransform].
|
||||
/// Creates an {@link AssetReader} using the `transform`, which should be a
|
||||
/// {@link Transform} or {@link AggregateTransform}.
|
||||
factory AssetReader.fromTransform(dynamic transform) =>
|
||||
new _TransformAssetReader(transform);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'package:angular2/src/transform/common/logging.dart';
|
|||
import 'package:barback/barback.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.
|
||||
Future<Map<AssetId, List<ClassDeclaration>>> createTypeMap(
|
||||
AssetReader reader, AssetId id) {
|
||||
|
|
|
@ -7,12 +7,12 @@ import 'package:source_span/source_span.dart';
|
|||
|
||||
BuildLogger _logger;
|
||||
|
||||
/// Prepares [logger] for use throughout the transformer.
|
||||
/// Prepares {@link logger} for use throughout the transformer.
|
||||
void init(Transform 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) {
|
||||
_logger = logger;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class TransformerOptions {
|
|||
/// The path to the files where the application's calls to `bootstrap` are.
|
||||
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.
|
||||
final List<String> reflectionEntryPoints;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ TransformerOptions parseBarbackSettings(BarbackSettings settings) {
|
|||
}
|
||||
|
||||
/// 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) {
|
||||
var value = config[paramName];
|
||||
if (value == null) return null;
|
||||
|
|
|
@ -13,8 +13,8 @@ import 'registered_type.dart';
|
|||
|
||||
export 'registered_type.dart';
|
||||
|
||||
/// A parser that reads `.ng_deps.dart` files (represented by [AssetId]s into
|
||||
/// easier to manage [NgDeps] files.
|
||||
/// A parser that reads `.ng_deps.dart` files (represented by {@link AssetId}s into
|
||||
/// easier to manage {@link NgDeps} files.
|
||||
class Parser {
|
||||
final AssetReader _reader;
|
||||
final _ParseNgDepsVisitor _visitor = new _ParseNgDepsVisitor();
|
||||
|
@ -28,7 +28,7 @@ class Parser {
|
|||
}
|
||||
|
||||
/// Parses only the `.ng_deps.dart` file represented by `id`.
|
||||
/// See also [parseRecursive].
|
||||
/// See also {@link parseRecursive}.
|
||||
Future<NgDeps> parse(AssetId id) async {
|
||||
if (!(await _reader.hasInput(id))) return null;
|
||||
var ngDeps = new NgDeps(await _reader.readAsString(id));
|
||||
|
@ -37,9 +37,9 @@ class Parser {
|
|||
return ngDeps;
|
||||
}
|
||||
|
||||
/// Parses the `.ng_deps.dart` file represented by [id] into an [NgDeps]
|
||||
/// object. All `.ng_deps.dart` files imported by [id] are then parsed. The
|
||||
/// results are added to [allDeps].
|
||||
/// Parses the `.ng_deps.dart` file represented by {@link id} into an {@link NgDeps}
|
||||
/// object. All `.ng_deps.dart` files imported by {@link id} are then parsed. The
|
||||
/// results are added to {@link allDeps}.
|
||||
Future<List<NgDeps>> _recurse(AssetId id,
|
||||
[List<NgDeps> allDeps, Set<AssetId> seen]) async {
|
||||
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.
|
||||
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('\$', '\\\$');
|
||||
|
||||
/// 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,
|
||||
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`.
|
||||
factory RegisteredType.fromMethodInvocation(MethodInvocation registerMethod) {
|
||||
var visitor = new _ParseRegisterTypeVisitor();
|
||||
|
|
|
@ -56,7 +56,7 @@ bool _isNotDartDirective(UriBasedDirective directive) {
|
|||
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.
|
||||
Future<Map<UriBasedDirective, String>> _processNgImports(AssetReader reader,
|
||||
AssetId entryPoint, Iterable<UriBasedDirective> directives) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import 'package:barback/barback.dart';
|
|||
import 'linker.dart';
|
||||
|
||||
/// 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
|
||||
/// dependencies.
|
||||
class DirectiveLinker extends Transformer {
|
||||
|
|
|
@ -19,7 +19,7 @@ import 'rewriter.dart';
|
|||
/// with @Component, @View, @Decorator, etc.
|
||||
///
|
||||
/// 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 {
|
||||
final TransformerOptions options;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:analyzer/analyzer.dart';
|
|||
import 'package:analyzer/src/generated/java_core.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 {
|
||||
bool _withParameterAnnotations = true;
|
||||
bool _withParameterTypes = true;
|
||||
|
@ -12,7 +12,7 @@ class _CtorTransformVisitor extends ToSourceVisitor {
|
|||
final PrintWriter writer;
|
||||
|
||||
/// 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 = {};
|
||||
|
||||
_CtorTransformVisitor(PrintWriter writer)
|
||||
|
@ -39,8 +39,8 @@ class _CtorTransformVisitor extends ToSourceVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
/// If [_withParameterTypes] is true, this method outputs [node]'s type. If
|
||||
/// [_withParameterNames] is true, this method outputs [node]'s identifier.
|
||||
/// If `_withParameterTypes` is true, this method outputs `node`'s type. If
|
||||
/// `_withParameterNames` is true, this method outputs `node`'s identifier.
|
||||
Object _visitNormalFormalParameter(
|
||||
NodeList<Annotation> metadata, TypeName type, SimpleIdentifier name) {
|
||||
if (_withParameterAnnotations && metadata != null) {
|
||||
|
@ -144,7 +144,7 @@ class _CtorTransformVisitor extends ToSourceVisitor {
|
|||
}
|
||||
|
||||
/// ToSourceVisitor designed to print 'parameters' values for Angular2's
|
||||
/// [registerType] calls.
|
||||
/// `registerType` calls.
|
||||
class ParameterTransformVisitor extends _CtorTransformVisitor {
|
||||
ParameterTransformVisitor(PrintWriter writer) : super(writer) {
|
||||
_withParameterNames = false;
|
||||
|
@ -178,7 +178,7 @@ class ParameterTransformVisitor extends _CtorTransformVisitor {
|
|||
}
|
||||
|
||||
/// ToSourceVisitor designed to print 'factory' values for Angular2's
|
||||
/// [registerType] calls.
|
||||
/// `registerType` calls.
|
||||
class FactoryTransformVisitor extends _CtorTransformVisitor {
|
||||
FactoryTransformVisitor(PrintWriter writer) : super(writer) {
|
||||
_withParameterAnnotations = false;
|
||||
|
@ -200,8 +200,8 @@ class FactoryTransformVisitor extends _CtorTransformVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
/// ToSourceVisitor designed to print a [ClassDeclaration] node as a
|
||||
/// 'annotations' value for Angular2's [registerType] calls.
|
||||
/// ToSourceVisitor designed to print a `ClassDeclaration` node as a
|
||||
/// 'annotations' value for Angular2's `registerType` calls.
|
||||
class AnnotationsTransformVisitor extends ToSourceVisitor {
|
||||
final 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: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.
|
||||
class 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.
|
||||
class ResolvedTester implements AstTester {
|
||||
final ClassElement _forbiddenClass;
|
||||
|
|
|
@ -25,7 +25,7 @@ class Codegen {
|
|||
/// Angular2 reflection statically.
|
||||
///
|
||||
/// The code generated here should follow the example of code generated for
|
||||
/// an [ImportDirective] node.
|
||||
/// an {@link ImportDirective} node.
|
||||
String codegenImport() {
|
||||
var count = 0;
|
||||
return importUris
|
||||
|
@ -36,9 +36,9 @@ class Codegen {
|
|||
/// Generates code to call the method which sets up Angular2 reflection
|
||||
/// statically.
|
||||
///
|
||||
/// If [reflectorAssignment] is provided, it is expected to be the node
|
||||
/// representing the [ReflectionCapabilities] assignment, and we will
|
||||
/// attempt to parse the access of [reflector] from it so that [reflector] is
|
||||
/// If `reflectorAssignment` is provided, it is expected to be the node
|
||||
/// representing the {@link ReflectionCapabilities} assignment, and we will
|
||||
/// attempt to parse the access of `reflector` from it so that `reflector` is
|
||||
/// properly prefixed if necessary.
|
||||
String codegenSetupReflectionCall(
|
||||
{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> {
|
||||
@override
|
||||
Expression visitAssignmentExpression(AssignmentExpression node) {
|
||||
|
|
|
@ -9,10 +9,10 @@ import 'codegen.dart';
|
|||
import 'rewriter.dart';
|
||||
|
||||
/// Finds the call to the Angular2 `ReflectionCapabilities` constructor
|
||||
/// in [reflectionEntryPoint] and replaces it with a call to
|
||||
/// `setupReflection` in [newEntryPoint].
|
||||
/// in `reflectionEntryPoint` and replaces it with a call to
|
||||
/// `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.
|
||||
Future<String> removeReflectionCapabilities(AssetReader reader,
|
||||
AssetId reflectionEntryPoint, Iterable<AssetId> newEntryPoints) async {
|
||||
|
|
|
@ -16,9 +16,9 @@ class Rewriter {
|
|||
: _tester = tester == null ? const AstTester() : tester;
|
||||
|
||||
/// Rewrites the provided code removing imports of the
|
||||
/// [ReflectionCapabilities] library and instantiations of
|
||||
/// [ReflectionCapabilities], as detected by the (potentially) provided
|
||||
/// [AstTester].
|
||||
/// {@link ReflectionCapabilities} library and instantiations of
|
||||
/// {@link ReflectionCapabilities}, as detected by the (potentially) provided
|
||||
/// {@link AstTester}.
|
||||
///
|
||||
/// To the extent possible, this method does not change line numbers or
|
||||
/// 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
|
||||
/// [ReflectionCapabilities] and removing its associated import.
|
||||
/// {@link ReflectionCapabilities} and removing its associated import.
|
||||
///
|
||||
/// This breaks our dependency on dart:mirrors, which enables smaller code
|
||||
/// size and better performance.
|
||||
|
|
|
@ -10,13 +10,13 @@ import 'package:barback/barback.dart';
|
|||
import 'remove_reflection_capabilities.dart';
|
||||
|
||||
/// 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.
|
||||
///
|
||||
/// 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
|
||||
/// [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.
|
||||
class ReflectionRemover extends Transformer {
|
||||
final TransformerOptions options;
|
||||
|
|
|
@ -26,7 +26,7 @@ import 'recording_reflection_capabilities.dart';
|
|||
/// Angular 2 `View` annotations it declares to generate `getter`s,
|
||||
/// `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 {
|
||||
var parser = new Parser(reader);
|
||||
NgDeps ngDeps = await parser.parse(entryPoint);
|
||||
|
@ -163,7 +163,7 @@ class _TemplateExtractor {
|
|||
}
|
||||
|
||||
/// 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> {
|
||||
final List<String> inlineValues = [];
|
||||
final List<String> urlValues = [];
|
||||
|
|
|
@ -12,9 +12,9 @@ import 'package:barback/barback.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
|
||||
/// use that template. It then generates code in place of those reflective
|
||||
/// accesses.
|
||||
|
|
|
@ -5,7 +5,7 @@ library angular2.test.transform;
|
|||
|
||||
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
|
||||
/// transitive dependencies.
|
||||
Future bootstrap(Type appComponentType,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
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
|
||||
/// tests causes issues with resolution due to transitive dependencies.
|
||||
class ReflectionCapabilities {}
|
||||
|
|
Loading…
Reference in New Issue