title: Angular2 - how to dynamic insert the component that were created?
body: <p>I have created some components through the code like:</p>
  
  <pre><code>resolveCom(com: any, viewContain: ViewContainerRef): ComponentRef&lt;any&gt; {
          let comFac = this.componentFactoryResolver.resolveComponentFactory(com)
          let newCom: ComponentRef&lt;any&gt; = viewContain.createComponent(comFac)
          newCom.changeDetectorRef.detectChanges()
          return newCom
     }
  </code></pre>
  
  <p>And I dynamic create some compoennts and save them into the array:</p>
  
  <pre><code>let newCom: ComponentRef&lt;any&gt; = this.resolveCom(item, viewContain)
  saveCom[key].push(newCom)
  </code></pre>
  
  <p>The view can show the components that were created.Now i want to hide or show these components but i don't want to destroy them and recreate them. 
  I saved them just now,can i dynamic insert the component that i save to the view ?</p>