title: How to dynamically add a cloned node in angular2 (equivalent to cloneNode)
body: <p>In Angular2, I need to duplicate a node rather than moving it in some cases. That node has angular2 properties so cloneNode doesn't work. How can I do it?</p>
  
  <p>*what doesn't work</p>
  
  <pre><code>    let el = &lt;HTMLElement&gt;document.getElementById(divId);
      if ((&lt;HTMLElement&gt;el.parentNode).id == 'itsMe')
          el = &lt;HTMLElement&gt;el.cloneNode(true);
      document.getElementById(anotherId).appendChild(el);
  </code></pre>
  
  <p>*what would work, from <a href="https://stackoverflow.com/questions/39081979/angular2-cloning-component-html-element-and-its-functionality/39220492">Angular2: Cloning component / HTML element and it&#39;s functionality</a></p>
  
  <pre><code>@Component({
    selector: 'my-app',
    template: `
      &lt;template #temp&gt;
          &lt;h1 [ngStyle]="{background: 'green'}"&gt;Test&lt;/h1&gt;
          &lt;p *ngIf="bla"&gt;Im not visible&lt;/p&gt;   
      &lt;/template&gt;
      &lt;template [ngTemplateOutlet]="temp"&gt;&lt;/template&gt;
      &lt;template [ngTemplateOutlet]="temp"&gt;&lt;/template&gt;
      `
  })
  
  export class AppComponent {
      bla: boolean = false;
      @ContentChild('temp') testEl: any;
  } 
  </code></pre>
  
  <p>But how to add a template dynamically?</p>