title: Angular, get component instance from inside a structural directive / from TemplateRef
body: <p>I have a structural directive which conditionally renders a given template or not based on some conditions and it's used like:</p>
  <pre><code>   &lt;my-component *myMayBeShow&gt;
  </code></pre>
  <p>The template is rendered by</p>
  <pre><code>const embeddedViewRef = this.viewContainer.createEmbeddedView(this.templateRef);
  </code></pre>
  <p>I can get the html nodes which were created:</p>
  <pre><code>embeddedViewRef.rootNodes[0]
  </code></pre>
  <p>But: how can i get the component instance &quot;MyComponent&quot; which were created by the embedded view?
  I need somethink like:
  <a href="https://angular.io/api/core/global/ngGetComponent" rel="nofollow noreferrer">https://angular.io/api/core/global/ngGetComponent</a>
  but that utils are designed for debugging and are avaialble only in dev mode.</p>