feat(di): Add the @Injectable
annotation
Add an annotation marking a class as available to `Injector`s.
This commit is contained in:
parent
a46af9c41c
commit
b656f63430
2
modules/angular2/di.js
vendored
2
modules/angular2/di.js
vendored
@ -1,4 +1,4 @@
|
|||||||
export {Inject, InjectPromise, InjectLazy, Optional, DependencyAnnotation} from './src/di/annotations';
|
export {Inject, InjectPromise, InjectLazy, Injectable, Optional, DependencyAnnotation} from './src/di/annotations';
|
||||||
export {Injector} from './src/di/injector';
|
export {Injector} from './src/di/injector';
|
||||||
export {Binding, Dependency, bind} from './src/di/binding';
|
export {Binding, Dependency, bind} from './src/di/binding';
|
||||||
export {Key, KeyRegistry} from './src/di/key';
|
export {Key, KeyRegistry} from './src/di/key';
|
||||||
|
19
modules/angular2/src/di/annotations.js
vendored
19
modules/angular2/src/di/annotations.js
vendored
@ -108,3 +108,22 @@ export class DependencyAnnotation {
|
|||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class annotation that marks a class as available to `Injector`s for
|
||||||
|
* creation.
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* class NeedsService {
|
||||||
|
* constructor(svc:UsefulService) {}
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @Injectable
|
||||||
|
* class UsefulService {}
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
export class Injectable {
|
||||||
|
@CONST()
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user