title: NG2: How can I access parent component generically?
body: <p>Before I begin please note that I originally asked this question as a feature request at the angular2 github site. However the request was closed and I was advised to post it here. 
  Here I am just repeating my initial request. However you can find some discussion by following the link:
  <a href="https://github.com/angular/angular/issues/10448" rel="nofollow noreferrer">https://github.com/angular/angular/issues/10448</a></p>
  
  <p>I need the ability to obtain a reference to the parent component generically without the child having to know the type of the parent component. Basically I need something like this (pseudocode):</p>
  
  <pre class="lang-js prettyprint-override"><code>    @Component({
          template: '&lt;child&gt;&lt;/child&gt;'
          directives: [Child]
      })
      class ParentComponent{}
  
      @Component({ selector: 'child' })
      class ChildComponent{
          constructor(@Parent() _parent: any){}
      }
  </code></pre>
  
  <p>Basically I need the <code>_parent</code> field of the <code>ChildComponent</code> to reference the <code>ParentComponent</code>. But notice how the type of <code>_parent</code> is <code>any</code>. It's <code>any</code> because it can be any, literally. <code>ChildComponent</code> is a generic component that can be used by any type of other component. I know there are solutions out there for this problem but they all entail the child knowing the type of the parent. It goes something like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>    @Component({ selector: 'child' })
      class ChildComponent{
          constructor(_parent: ParentComponent){}
      }
  </code></pre>
  
  <p>But again, this will not work for me because <code>ChildComponent</code> can be used in any type of other component, and neither one knows the type of the other. So what I need is some generic way to inject into <code>ChildComponent</code> its parent component, as set in the component tree, without <code>ChildComponent</code> knowing the parent type. Does anyone know how I can accomplish this?</p>