Skip to content

Commit b656f63

Browse files
Tim Blasimhevery
authored andcommitted
feat(di): Add the @Injectable annotation
Add an annotation marking a class as available to `Injector`s.
1 parent a46af9c commit b656f63

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

modules/angular2/di.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export {Inject, InjectPromise, InjectLazy, Optional, DependencyAnnotation} from './src/di/annotations';
1+
export {Inject, InjectPromise, InjectLazy, Injectable, Optional, DependencyAnnotation} from './src/di/annotations';
22
export {Injector} from './src/di/injector';
33
export {Binding, Dependency, bind} from './src/di/binding';
44
export {Key, KeyRegistry} from './src/di/key';

modules/angular2/src/di/annotations.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,23 @@ export class DependencyAnnotation {
107107
@CONST()
108108
constructor() {
109109
}
110-
}
110+
}
111+
112+
/**
113+
* A class annotation that marks a class as available to `Injector`s for
114+
* creation.
115+
*
116+
* ```
117+
* class NeedsService {
118+
* constructor(svc:UsefulService) {}
119+
* }
120+
*
121+
* @Injectable
122+
* class UsefulService {}
123+
* ```
124+
*/
125+
export class Injectable {
126+
@CONST()
127+
constructor() {
128+
}
129+
}

0 commit comments

Comments
 (0)