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:
@@ -279,7 +279,7 @@ class DynamicComp {
|
||||
|
||||
@Component({
|
||||
selector: 'hello-cmp',
|
||||
injectables: [DynamicallyCreatedComponentService]
|
||||
appInjector: [DynamicallyCreatedComponentService]
|
||||
})
|
||||
@View({
|
||||
template: "{{greeting}}"
|
||||
|
||||
@@ -516,7 +516,7 @@ export function main() {
|
||||
|
||||
it("should instantiate component directives that depend on app services in the shadow app injector", () => {
|
||||
var directiveAnnotation = new Component({
|
||||
injectables: [
|
||||
appInjector: [
|
||||
bind("service").toValue("service")
|
||||
]
|
||||
});
|
||||
@@ -531,7 +531,7 @@ export function main() {
|
||||
|
||||
it("should not instantiate other directives that depend on app services in the shadow app injector", () => {
|
||||
var directiveAnnotation = new Component({
|
||||
injectables: [
|
||||
appInjector: [
|
||||
bind("service").toValue("service")
|
||||
]
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ void functionThatThrows() {
|
||||
|
||||
main() {
|
||||
describe('TypeLiteral', () {
|
||||
it('should publish via injectables',
|
||||
it('should publish via appInjector',
|
||||
inject([TestBed, AsyncTestCompleter], (tb, async) {
|
||||
tb.overrideView(Dummy, new View(
|
||||
template: '<type-literal-component></type-literal-component>',
|
||||
@@ -57,7 +57,7 @@ class Dummy {}
|
||||
|
||||
@Component(
|
||||
selector: 'type-literal-component',
|
||||
injectables: const [
|
||||
appInjector: const [
|
||||
const Binding(
|
||||
const TypeLiteral<List<String>>(),
|
||||
toValue: const <String>['Hello', 'World'])
|
||||
|
||||
+2
-20
@@ -27,7 +27,6 @@ import {PipeRegistry, defaultPipeRegistry,
|
||||
ChangeDetection, DynamicChangeDetection, Pipe, ChangeDetectorRef, ON_PUSH} from 'angular2/change_detection';
|
||||
|
||||
import {Directive, Component} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {DynamicComponentLoader} from 'angular2/src/core/compiler/dynamic_component_loader';
|
||||
import {QueryList} from 'angular2/src/core/compiler/query_list';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
import {Parent, Ancestor} from 'angular2/src/core/annotations_impl/visibility';
|
||||
@@ -1112,7 +1111,7 @@ class ComponentWithPipes {
|
||||
|
||||
@Component({
|
||||
selector: 'child-cmp',
|
||||
injectables: [MyService],
|
||||
appInjector: [MyService],
|
||||
})
|
||||
@View({
|
||||
directives: [MyDir],
|
||||
@@ -1177,7 +1176,7 @@ class CompWithAncestor {
|
||||
|
||||
@Component({
|
||||
selector: '[child-cmp2]',
|
||||
injectables: [MyService]
|
||||
appInjector: [MyService]
|
||||
})
|
||||
class ChildComp2 {
|
||||
ctxProp:string;
|
||||
@@ -1414,23 +1413,6 @@ class NeedsPublicApi {
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'child',
|
||||
injectables: [AppDependency]
|
||||
})
|
||||
@View({
|
||||
template: `<div>{{parent.message}}</div>,<div>{{appDependency.parent.message}}</div>`
|
||||
})
|
||||
class ChildComponent {
|
||||
parent:ParentInterface;
|
||||
appDependency:AppDependency;
|
||||
|
||||
constructor(p:ParentInterface, a:AppDependency) {
|
||||
this.parent = p;
|
||||
this.appDependency = a;
|
||||
}
|
||||
}
|
||||
|
||||
@Directive({
|
||||
selector: '[toolbar-vc]',
|
||||
properties: {
|
||||
|
||||
@@ -14,7 +14,7 @@ void initReflector(reflector) {
|
||||
'parameters': const [],
|
||||
'annotations': const [
|
||||
const Component(
|
||||
selector: '[soup]', injectables: const [dep.DependencyComponent])
|
||||
selector: '[soup]', appInjector: const [dep.DependencyComponent])
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ void initReflector(reflector) {
|
||||
'parameters': const [],
|
||||
'annotations': const [
|
||||
const Component(
|
||||
selector: '[soup]', injectables: const [dep.DependencyComponent])
|
||||
selector: '[soup]', appInjector: const [dep.DependencyComponent])
|
||||
]
|
||||
});
|
||||
i0.initReflector(reflector);
|
||||
|
||||
Reference in New Issue
Block a user