
p.location-badge.
  exported from <a href='../core'>angular2/core</a>
  defined in <a href="https://github.com/angular/angular/tree/3a0410a/modules/angular2/src/core/annotations_impl/visibility.ts#L15-L58">angular2/src/core/annotations_impl/visibility.ts (line 15)</a>

:markdown
  Specifies that an injector should retrieve a dependency from its element.
  
  ## Example
  
  Here is a simple directive that retrieves a dependency from its element.
  
  ```
  @Directive({
    selector: '[dependency]',
    properties: [
      'id: dependency'
    ]
  })
  class Dependency {
    id:string;
  }
  
  
  @Directive({
    selector: '[my-directive]'
  })
  class Dependency {
    constructor(@Self() dependency:Dependency) {
      expect(dependency.id).toEqual(1);
    };
  }
  ```
  
  We use this with the following HTML template:
  
  ```
  <div dependency="1" my-directive></div>
  ```
  
.l-main-section
  h2 Members
  .l-sub-section
    h3 constructor

    
    pre.prettyprint
      code.
        constructor()
    
    :markdown
      
      




  .l-sub-section
    h3 toString

    
    pre.prettyprint
      code.
        toString()
    
    :markdown

      
      




