52 lines
912 B
Plaintext
52 lines
912 B
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.33/modules/angular2/src/di/metadata.ts#L83-L106">angular2/src/di/metadata.ts (line 83)</a>
|
|
|
|
:markdown
|
|
Specifies that an injector should retrieve a dependency from itself.
|
|
|
|
## Example
|
|
|
|
```
|
|
class Dependency {
|
|
}
|
|
|
|
class NeedsDependency {
|
|
constructor(public @Self() dependency:Dependency) {}
|
|
}
|
|
|
|
var inj = Injector.resolveAndCreate([Dependency, NeedsDependency]);
|
|
var nd = inj.get(NeedsDependency);
|
|
expect(nd.dependency).toBeAnInstanceOf(Dependency);
|
|
```
|
|
|
|
|
|
|
|
.l-main-section
|
|
h2 Annotations
|
|
.l-sub-section
|
|
h3.annotation CONST
|
|
pre.prettyprint
|
|
code.
|
|
@CONST()
|
|
|
|
|
|
.l-main-section
|
|
h2 Members
|
|
.l-sub-section
|
|
h3 toString
|
|
|
|
|
|
pre.prettyprint
|
|
code.
|
|
toString()
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
|