0

I create instance of the MyCcomponentContainer:

 var factory = this.resolver.resolveComponentFactory(MyComponentContainer);

The template of MyComponentContainer:

<div #container class="myclass"><ng-content></ng-content></div>

Can I now change/edit/add something to this template after creating the component dynamically? For example I would like to add html that will replace the <ng-content>.

I'm looking for a way to replace ng-content with some HTML.

AngularOne
  • 2,760
  • 6
  • 32
  • 46
  • If you are creating a component inside the container, doesn't the html content become the injected components template? – eko May 04 '17 at 17:29
  • 1
    You can pass `projectableNodes` to [createComponent](https://angular.io/docs/ts/latest/api/core/index/ViewContainerRef-class.html#!#createComponent-anchor), this will be transcluded to ``. – Günter Zöchbauer May 04 '17 at 17:34
  • projectableNodes can work with html templae file for example? It is only for creating the nodes by code? What I'm asking is can html-file.html template be transclude by code somehow? – AngularOne May 04 '17 at 17:43

0 Answers0