chore: removed angular2.api.ts

BREACKING CHANGE:

We export InjectMetadata instead of InjectAnnotation
This commit is contained in:
vsavkin
2015-07-08 12:04:24 -07:00
parent d6dadc6efc
commit b54e7214f0
25 changed files with 254 additions and 208 deletions
@@ -40,8 +40,7 @@ import {
Directive,
onDestroy
} from 'angular2/annotations';
import {bind, Injector, Binding, resolveBindings, Optional, Inject, Injectable, Self, Parent, Ancestor, Unbounded, self} from 'angular2/di';
import * as diAnn from 'angular2/src/di/annotations_impl';
import {bind, Injector, Binding, resolveBindings, Optional, Inject, Injectable, Self, Parent, Ancestor, Unbounded, self, InjectMetadata, ParentMetadata} from 'angular2/di';
import {AppProtoView, AppView} from 'angular2/src/core/compiler/view';
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
import {ProtoViewRef} from 'angular2/src/core/compiler/view_ref';
@@ -595,7 +594,7 @@ export function main() {
bind('injectable2')
.toFactory(
(val) => `${val}-injectable2`,
[[new diAnn.Inject('injectable1'), new diAnn.Parent()]])
[[new InjectMetadata('injectable1'), new ParentMetadata()]])
]
}))]);
expect(childInj.get('injectable2')).toEqual('injectable1-injectable2');
@@ -43,7 +43,8 @@ import {
Inject,
Parent,
Ancestor,
Unbounded
Unbounded,
UnboundedMetadata
} from 'angular2/di';
import {
PipeFactory,
@@ -58,7 +59,6 @@ import {
import {Directive, Component, View, Attribute, Query} from 'angular2/annotations';
import * as viewAnn from 'angular2/src/core/annotations_impl/view';
import * as visAnn from 'angular2/src/di/annotations_impl';
import {QueryList} from 'angular2/src/core/compiler/query_list';
@@ -1779,7 +1779,7 @@ function createParentBus(peb) {
selector: 'parent-providing-event-bus',
hostInjector: [
new Binding(EventBus,
{toFactory: createParentBus, deps: [[EventBus, new visAnn.Unbounded()]]})
{toFactory: createParentBus, deps: [[EventBus, new UnboundedMetadata()]]})
]
})
@View({
+11 -9
View File
@@ -14,20 +14,22 @@ import {
ResolvedBinding,
Key,
forwardRef,
DependencyAnnotation,
Injectable
DependencyMetadata,
Injectable,
InjectMetadata,
self,
unbounded
} from 'angular2/di';
import {InjectorInlineStrategy, InjectorDynamicStrategy} from 'angular2/src/di/injector';
import {Optional, Inject} from 'angular2/src/di/decorators';
import * as ann from 'angular2/src/di/annotations_impl';
class CustomDependencyAnnotation extends DependencyAnnotation {}
class CustomDependencyMetadata extends DependencyMetadata {}
class Engine {}
@Injectable(ann.self)
@Injectable(self)
class EngineWithSetVisibility {
}
@@ -407,12 +409,12 @@ export function main() {
var bindings = Injector.resolve([
bind("token")
.toFactory((e) => "result",
[[new ann.Inject("dep"), new CustomDependencyAnnotation()]])
[[new InjectMetadata("dep"), new CustomDependencyMetadata()]])
]);
var binding = bindings[0];
expect(binding.dependencies[0].key.token).toEqual("dep");
expect(binding.dependencies[0].properties).toEqual([new CustomDependencyAnnotation()]);
expect(binding.dependencies[0].properties).toEqual([new CustomDependencyMetadata()]);
});
});
@@ -420,13 +422,13 @@ export function main() {
it("should use the provided visibility", () => {
var bindings = Injector.resolve([CarNeedsEngineWithSetVisibility, EngineWithSetVisibility]);
var carBinding = bindings[0];
expect(carBinding.dependencies[0].visibility).toEqual(ann.self);
expect(carBinding.dependencies[0].visibility).toEqual(self);
});
it("should set the default visibility to unbounded", () => {
var bindings = Injector.resolve([Car, Engine]);
var carBinding = bindings[0];
expect(carBinding.dependencies[0].visibility).toEqual(ann.unbounded);
expect(carBinding.dependencies[0].visibility).toEqual(unbounded);
});
});
});
@@ -43,8 +43,8 @@ void allTests() {
'angular2|lib/src/reflection/reflection_capabilities.dart':
'../common/reflection_capabilities.dart',
'angular2|lib/di.dart': '../../../lib/di.dart',
'angular2|lib/src/di/annotations_impl.dart':
'../../../lib/src/di/annotations_impl.dart',
'angular2|lib/src/di/decorators.dart':
'../../../lib/src/di/decorators.dart',
};
var tests = [