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

56 lines
1.0 KiB
Plaintext

p.location-badge.
exported from <a href='../di'>angular2/di</a>
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.32/modules/angular2/src/di/metadata.ts#L34-L65">angular2/src/di/metadata.ts (line 34)</a>
:markdown
`DependencyMetadata is used by the framework to extend DI.
Only metadata implementing `DependencyMetadata` are added to the list of dependency
properties.
For example:
```
class Exclude extends DependencyMetadata {}
class NotDependencyProperty {}
class AComponent {
constructor(@Exclude @NotDependencyProperty aService:AService) {}
}
```
will create the following dependency:
```
new Dependency(Key.get(AService), [new Exclude()])
```
The framework can use `new Exclude()` to handle the `aService` dependency
in a specific way.
.l-main-section
h2 Annotations
.l-sub-section
h3.annotation CONST
pre.prettyprint
code.
@CONST()
.l-main-section
h2 Members
.l-sub-section
h3 token
:markdown