refactor(core): renamed injectables into appInjector
BREAKING CHANGES Before: @Component({injectables: [Type]} class MyCmp{} After: @Component({appInjector: [Type]} class MyCmp{}
This commit is contained in:
@ -714,7 +714,7 @@ 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 {@link Injector} which is configured with the `injectables` for the {@link Component}.
|
||||
* - creates a child {@link Injector} which is configured with the `appInjector` for the {@link Component}.
|
||||
*
|
||||
* All template expressions and statements are then evaluated against the component instance.
|
||||
*
|
||||
@ -800,16 +800,16 @@ 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 `appInjector` 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 `appInjector` 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 {@link Injector} injectable configuration.
|
||||
* The syntax for configuring the `appInjector` injectable is identical to {@link Injector} injectable configuration.
|
||||
* See {@link Injector} for additional detail.
|
||||
*
|
||||
*
|
||||
@ -826,7 +826,7 @@ export class Component extends Directive {
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'greet',
|
||||
* injectables: [
|
||||
* appInjector: [
|
||||
* Greeter
|
||||
* ]
|
||||
* })
|
||||
@ -843,7 +843,7 @@ export class Component extends Directive {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
injectables:List;
|
||||
appInjector:List;
|
||||
|
||||
@CONST()
|
||||
constructor({
|
||||
@ -854,7 +854,7 @@ export class Component extends Directive {
|
||||
hostProperties,
|
||||
hostAttributes,
|
||||
hostActions,
|
||||
injectables,
|
||||
appInjector,
|
||||
lifecycle,
|
||||
changeDetection = DEFAULT,
|
||||
compileChildren = true
|
||||
@ -866,7 +866,7 @@ export class Component extends Directive {
|
||||
hostProperties:any,
|
||||
hostAttributes:any,
|
||||
hostActions:any,
|
||||
injectables:List,
|
||||
appInjector:List,
|
||||
lifecycle:List,
|
||||
changeDetection:string,
|
||||
compileChildren:boolean
|
||||
@ -885,7 +885,7 @@ export class Component extends Directive {
|
||||
});
|
||||
|
||||
this.changeDetection = changeDetection;
|
||||
this.injectables = injectables;
|
||||
this.appInjector = appInjector;
|
||||
}
|
||||
}
|
||||
|
||||
|
4
modules/angular2/src/core/application.js
vendored
4
modules/angular2/src/core/application.js
vendored
@ -184,7 +184,7 @@ function _createNgZone(givenReporter:Function): NgZone {
|
||||
* 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 platform injector) and configures the injector with the component's
|
||||
* `injectables`. Optionally, you can also override the injector configuration for an app by invoking
|
||||
* `appInjector`. 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.
|
||||
* 4. It creates a shadow DOM on the selected component's host element and loads the template into it.
|
||||
@ -227,7 +227,7 @@ function _createNgZone(givenReporter:Function): NgZone {
|
||||
* # API
|
||||
* - `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 `injectables` for the
|
||||
* - `componentInjectableBindings`: An additional set of bindings that can be added to `appInjector` for the
|
||||
* {@link Component} to override default injection behavior.
|
||||
* - `errorReporter`: `function(exception:any, stackTrace:string)` a default error reporter for unhandled exceptions.
|
||||
*
|
||||
|
@ -279,8 +279,8 @@ export class DirectiveBinding extends ResolvedBinding {
|
||||
var changeDetection = null;
|
||||
if (ann instanceof Component) {
|
||||
renderType = DirectiveMetadata.COMPONENT_TYPE;
|
||||
if (isPresent(ann.injectables)) {
|
||||
resolvedInjectables = Injector.resolve(ann.injectables);
|
||||
if (isPresent(ann.appInjector)) {
|
||||
resolvedInjectables = Injector.resolve(ann.appInjector);
|
||||
}
|
||||
changeDetection = ann.changeDetection;
|
||||
} else {
|
||||
|
@ -14,7 +14,7 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
* ```javascript
|
||||
* @Component({
|
||||
* selector: 'my-app',
|
||||
* injectables: [
|
||||
* appInjector: [
|
||||
* bind(ExceptionHandler).toClass(MyExceptionHandler)
|
||||
* ]
|
||||
* })
|
||||
|
2
modules/angular2/src/forms/form_builder.js
vendored
2
modules/angular2/src/forms/form_builder.js
vendored
@ -14,7 +14,7 @@ import * as modelModule from './model';
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'login-comp',
|
||||
* injectables: [
|
||||
* appInjector: [
|
||||
* FormBuilder
|
||||
* ]
|
||||
* })
|
||||
|
Reference in New Issue
Block a user