docs: change primordial injector to platform injector
This commit is contained in:
parent
0a200aff70
commit
447018b54b
|
@ -7,15 +7,29 @@ import {DEFAULT} from './constants';
|
|||
import {ChangeDetection, ProtoChangeDetector} from './interfaces';
|
||||
import {Injectable} from 'angular2/di';
|
||||
|
||||
/**
|
||||
* Structural diffing for `Object`s and `Map`s.
|
||||
*
|
||||
* @exportedAs angular2/pipes
|
||||
*/
|
||||
export var keyValDiff = [
|
||||
new KeyValueChangesFactory(),
|
||||
new NullPipeFactory()
|
||||
];
|
||||
|
||||
/**
|
||||
* Structural diffing for `Iterable` types such as `Array`s.
|
||||
*
|
||||
* @exportedAs angular2/pipes
|
||||
*/
|
||||
export var iterableDiff = [
|
||||
new IterableChangesFactory(),
|
||||
new NullPipeFactory()
|
||||
];
|
||||
|
||||
export var defaultPipes = {
|
||||
"iterableDiff" : [
|
||||
new IterableChangesFactory(),
|
||||
new NullPipeFactory()
|
||||
],
|
||||
"keyValDiff" : [
|
||||
new KeyValueChangesFactory(),
|
||||
new NullPipeFactory()
|
||||
]
|
||||
"iterableDiff" : iterableDiff,
|
||||
"keyValDiff" : keyValDiff
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ import {DEFAULT} from 'angular2/change_detection';
|
|||
* - *Pre-existing Injectors*:
|
||||
* - The terminal [Injector] cannot resolve dependencies. It either throws an error or, if the dependency was
|
||||
* specified as `@Optional`, returns `null`.
|
||||
* - The primordial 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
|
||||
* as the components in the DOM.
|
||||
* - *Element Injectors*: Each component has a Shadow DOM. Within the Shadow DOM each element has an [ElementInjector]
|
||||
|
@ -830,7 +830,7 @@ export class Decorator extends Directive {
|
|||
* @Viewport({
|
||||
* selector: '[unless]',
|
||||
* properties: {
|
||||
* 'condition': 'unless'
|
||||
* 'unless': 'unless'
|
||||
* }
|
||||
* })
|
||||
* export class Unless {
|
||||
|
@ -842,7 +842,7 @@ export class Decorator extends Directive {
|
|||
* this.prevCondition = null;
|
||||
* }
|
||||
*
|
||||
* set condition(newCondition) {
|
||||
* set unless(newCondition) {
|
||||
* if (newCondition && (isBlank(this.prevCondition) || !this.prevCondition)) {
|
||||
* this.prevCondition = true;
|
||||
* this.viewContainer.clear();
|
||||
|
|
|
@ -196,7 +196,7 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
|
|||
*
|
||||
* 1. It uses the component's `selector` property to locate the DOM element which needs to be upgraded into
|
||||
* the angular component.
|
||||
* 2. It creates a new child injector (from the primordial 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
|
||||
* `bootstrap` with the `componentInjectableBindings` argument.
|
||||
* 3. It creates a new [Zone] and connects it to the angular application's change detection domain instance.
|
||||
|
@ -226,12 +226,12 @@ function _createVmZone(givenReporter:Function): VmTurnZone {
|
|||
* single change detection zone is created and therefore data can be shared across the applications.
|
||||
*
|
||||
*
|
||||
* ## Primordial Injector
|
||||
* ## Platform Injector
|
||||
*
|
||||
* When working within a browser window, there are many singleton resources: cookies, title, location, and others.
|
||||
* Angular services that represent these resources must likewise be shared across all Angular applications that
|
||||
* occupy the same browser window. For this reason, Angular creates exactly one global primordial injector which stores
|
||||
* all shared services, and each angular application injector has the primordial injector as its parent.
|
||||
* occupy the same browser window. For this reason, Angular creates exactly one global platform injector which stores
|
||||
* all shared services, and each angular application injector has the platform injector as its parent.
|
||||
*
|
||||
* Each application has its own private injector as well. When there are multiple applications on a page, Angular treats
|
||||
* each application injector's services as private to that application.
|
||||
|
|
|
@ -172,7 +172,7 @@ 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
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
@ -293,7 +293,14 @@ export class ResolvedBinding {
|
|||
/**
|
||||
* Provides an API for imperatively constructing [Binding]s.
|
||||
*
|
||||
* This is only relevant for JavaScript.
|
||||
* This is only relevant for JavaScript. See {@link BindingBuilder}.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* ```javascript
|
||||
* bind(MyInterface).toClass(MyClass)
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* @exportedAs angular2/di
|
||||
*/
|
||||
|
@ -440,7 +447,7 @@ 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
|
||||
* 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.
|
||||
*/
|
||||
toAsyncFactory(factoryFunction:Function, dependencies:List = null):Binding {
|
||||
|
|
Loading…
Reference in New Issue