SkipSelfMetadata

export class SkipSelfMetadata

exported from angular2/core defined in angular2/src/core/di/metadata.ts (line 150)

Specifies that the dependency resolution should start from the parent injector.

Example (live demo)

class Dependency { } @Injectable() class NeedsDependency { dependency; constructor(@SkipSelf() dependency:Dependency) { this.dependency = dependency; } } var parent = Injector.resolveAndCreate([Dependency]); var child = parent.resolveAndCreateChild([NeedsDependency]); expect(child.get(NeedsDependency).dependency instanceof Depedency).toBe(true); var inj = Injector.resolveAndCreate([Dependency, NeedsDependency]); expect(() => inj.get(NeedsDependency)).toThrowError();

Members

toString() : string

Not Yet Documented