Richard Szabo
Richard Szabo

Reputation: 41

Content projection in dynamic Angular components

Is there a way to use content projection in dynamically loaded & created Angular 2 components? By dynamic loading & creation i mean components aren't known at compilation time, they will be loaded & compiled & instantiated in run time.

Upvotes: 1

Views: 1585

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657118

You pass them as projectableNodes to ViewContainerRef.createComponent()

https://angular.io/docs/ts/latest/api/core/index/ViewContainerRef-class.html#!#createComponent-anchor

Upvotes: 1

Related Questions