Inject parent component of the same type as child component
<p>In Angular 2, a child component can get its parent component injected through a constructor parameter. Example:</p>

<pre><code>@Component({...})
export class ParentComponent {
  ...
}

@Component({...})
export class ChildComponent {
  constructor(private parent: ParentComponent) { }
  ...
}
</code></pre>

<p>This works nice and well as long the parent and child are of different types.</p>

<p>However, another typical use case is a tree structure where each tree node is displayed as a separate component. What should we do if each of the tree node components should have access to its parent? I have tried this:</p>

<pre><code>@Component({...})
export class TreeNodeComponent {
  constructor(private parent: TreeNodeComponent) { }
...
}
</code></pre>

<p>But this fails with the following runtime exception:</p>

<pre><code>EXCEPTION: Cannot instantiate cyclic dependency!
</code></pre>

<p>I guess the reason is that Angular 2 injects the component itself instead of its parent component. </p>

<p>How can I tell angular to inject a component's parent component even though they are of the same type?</p>

<p><strong>Plunker</strong> <a href="https://plnkr.co/edit/ddvupV?p=preview" rel="noreferrer">https://plnkr.co/edit/ddvupV?p=preview</a></p>