title: How to getting a reference to elements within the container of an angular structural directive
body: <p>I have the following template with a test structural directive called <code>*appUnless</code>:</p>
  <pre><code>&lt;h1 *appUnless&gt;
    &lt;app-hello&gt;&lt;/app-hello&gt;
    &lt;input type=&quot;text&quot; value=&quot;hello&quot; /&gt;
  &lt;/h1&gt;
  </code></pre>
  <p>Inside of my structural directive, so far I have this:</p>
  <pre><code>import {
    Directive,
    Input,
    TemplateRef,
    ViewContainerRef,
  } from &quot;@angular/core&quot;;
  
  @Directive({
    selector: &quot;[appUnless]&quot;,
  })
  export class UnlessDirective {
    constructor(
      private templateRef: TemplateRef&lt;any&gt;,
      private viewContainer: ViewContainerRef
    ) {}
  
    @Input()
    set appUnless(message: string) {
      const embeddedViewRef = this.viewContainer.createEmbeddedView(
        this.templateRef
      );
    }
  }
  </code></pre>
  <p>How do I get a reference to the <code>input</code> element from within the directive? I want to be able to refer to the <code>input</code> no different than if I had placed a template reference declaration on it, i.e., if I were to do <code>&lt;input #myInput&gt;</code>. Obviously, since I don't control the contents of what is placed inside of the container, I can't place <code>#myInput</code> into the template.</p>
  <p>Also, how do I get a reference to the <code>AppHelloComponent</code> (one that backs <code>app-hello</code>) with correct type from within this directive?</p>