title: Angular 4: Get ViewContainerRef of inserted dynamic HTML element
body: <p>I am inserting dynamic page content like this in angular 4:</p>
  
  <pre><code>&lt;app-component&gt;
      &lt;main [innerHTML]="dynamicHTML"&gt;&lt;/main&gt;
  &lt;/app-component&gt;
  </code></pre>
  
  <p>Which will render to:</p>
  
  <pre><code>&lt;app-component&gt;
      &lt;main&gt;
          &lt;div&gt;
              &lt;div id="insertionPoint"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/main&gt;
  &lt;/app-component&gt;
  </code></pre>
  
  <p>Is it possible to get a <code>ViewContainerRef</code> of the <code>div#insertionPoint</code> that has been dynamically added. The <code>div#insertionPoint</code> could be anywhere in a large HTML document that is loaded into <code>&lt;main&gt;</code>.</p>
  
  <p>I would like to use the <code>ViewContainerRef.createComponent()</code> along with the <code>ComponentFactoryResolver</code> to insert an Angular Component inside the dynamic HTML.</p>