p. exported from angular2/annotations defined in angular2/src/core/annotations/visibility.js (line 44) :markdown Specifies that an injector should retrieve a dependency from the direct parent. ## Example Here is a simple directive that retrieves a dependency from its parent element. ``` @Decorator({ selector: '[dependency]', properties: { 'id':'dependency' } }) class Dependency { id:string; } @Decorator({ selector: '[my-directive]' }) class Dependency { constructor(@Parent() dependency:Dependency) { expect(dependency.id).toEqual(1); }; } ``` We use this with the following HTML template: ```
``` The `@Parent()` annotation in our constructor forces the injector to retrieve the dependency from the parent element (even thought the current element could resolve it): Angular injects `dependency=1`. .l-main-section h2 Members .l-sub-section h3 constructor pre.prettyprint code. constructor() :markdown