61 lines
1.1 KiB
Plaintext
61 lines
1.1 KiB
Plaintext
|
|
||
|
p.
|
||
|
<span class="location-badge">exported from <a href="/angular2/di_annotations">angular2/di_annotations</a></span>
|
||
|
defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/di/annotations.js#L109">angular2/src/di/annotations.js (line 109)</a>
|
||
|
|
||
|
:markdown
|
||
|
`DependencyAnnotation` is used by the framework to extend DI.
|
||
|
|
||
|
Only annotations implementing `DependencyAnnotation` will be added
|
||
|
to the list of dependency properties.
|
||
|
|
||
|
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 constructor
|
||
|
|
||
|
|
||
|
pre.prettyprint
|
||
|
code.
|
||
|
()
|
||
|
|
||
|
|
||
|
|
||
|
:markdown
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
.l-sub-section
|
||
|
h3 token
|
||
|
|
||
|
|
||
|
|
||
|
:markdown
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|