angular-cn/public/docs/js/latest/api/di/DependencyAnnotation-class.jade

46 lines
943 B
Plaintext
Raw Normal View History

2015-04-19 13:53:18 -07:00
2015-04-22 08:06:51 -07:00
p.location-badge.
2015-06-01 22:51:00 -07:00
exported from <a href='../di'>angular2/di</a>
defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/di/annotations_impl.ts#L72-L105">angular2/src/di/annotations_impl.ts (line 72)</a>
2015-04-19 13:53:18 -07:00
:markdown
`DependencyAnnotation` is used by the framework to extend DI.
2015-06-01 22:51:00 -07:00
Only annotations implementing `DependencyAnnotation` are added to the list of dependency
properties.
2015-04-19 13:53:18 -07:00
For example:
```
class Parent extends DependencyAnnotation {}
class NotDependencyProperty {}
class AComponent {
constructor(@Parent @NotDependencyProperty aService:AService) {}
}
```
will create the following dependency:
```
new Dependency(Key.get(AService), [new Parent()])
```
The framework can use `new Parent()` to handle the `aService` dependency
in a specific way.
.l-main-section
h2 Members
.l-sub-section
h3 token
:markdown
2015-04-19 13:53:18 -07:00
2015-06-01 22:51:00 -07:00
2015-04-19 13:53:18 -07:00