
p.location-badge.
  exported from <a href="/angular2/annotations.html">angular2/annotations</a>
  defined in <a href="https://github.com/angular/angular/tree/master/modules/angular2/src/core/annotations_impl/visibility.js#L44">angular2/src/core/annotations_impl/visibility.js (line 44)</a>

: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.
  
  ```
  @Directive({
    selector: '[dependency]',
    properties: {
      'id':'dependency'
    }
  })
  class Dependency {
    id:string;
  }
  
  
  @Directive({
    selector: '[my-directive]'
  })
  class Dependency {
    constructor(@Parent() dependency:Dependency) {
      expect(dependency.id).toEqual(1);
    };
  }
  ```
  
  We use this with the following HTML template:
  
  ```
  <div dependency="1">
    <div dependency="2" my-directive></div>
  </div>
  ```
  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
      



