61 lines
1.1 KiB
Plaintext
61 lines
1.1 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.33/modules/angular2/src/di/metadata.ts#L106-L138">angular2/src/di/metadata.ts (line 106)</a>
|
||
|
|
||
|
:markdown
|
||
|
Specifies that the dependency resolution should start from the parent injector.
|
||
|
|
||
|
## Example
|
||
|
|
||
|
|
||
|
```
|
||
|
class Service {}
|
||
|
|
||
|
class ParentService implements Service {
|
||
|
}
|
||
|
|
||
|
class ChildService implements Service {
|
||
|
constructor(public @SkipSelf() parentService:Service) {}
|
||
|
}
|
||
|
|
||
|
var parent = Injector.resolveAndCreate([
|
||
|
bind(Service).toClass(ParentService)
|
||
|
]);
|
||
|
var child = parent.resolveAndCreateChild([
|
||
|
bind(Service).toClass(ChildSerice)
|
||
|
]);
|
||
|
var s = child.get(Service);
|
||
|
expect(s).toBeAnInstanceOf(ChildService);
|
||
|
expect(s.parentService).toBeAnInstanceOf(ParentService);
|
||
|
```
|
||
|
|
||
|
|
||
|
|
||
|
.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
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|