How can I use/create dynamic template to compile dynamic Component with Angular 2.0?
<p>I want to dynamically create a template. This should be used to build a <code>ComponentType</code> at runtime and place <em>(even replace)</em> it somewhere inside of the hosting Component. </p>

<p>Until RC4 I was using <code>ComponentResolver</code>, but with RC5 I get the following message:</p>

<pre class="lang-none prettyprint-override"><code>ComponentResolver is deprecated for dynamic compilation.
Use ComponentFactoryResolver together with @NgModule/@Component.entryComponents or ANALYZE_FOR_ENTRY_COMPONENTS provider instead.
For runtime compile only, you can also use Compiler.compileComponentSync/Async.
</code></pre>

<p>I found this document (<a href="https://docs.google.com/document/d/1VRNljdv-6QDY4_I0xx3DHd-IZ19QlthheMLdGGKAAzM/edit?usp=sharing" rel="noreferrer">Angular 2 Synchronous Dynamic Component Creation</a>)</p>

<p>And understand that I can use either</p>

<ul>
<li>Kind of dynamic <code>ngIf</code> with <code>ComponentFactoryResolver</code>. If I pass known components inside of <code>@Component({entryComponents: [comp1, comp2], ...})</code> - I can use <code>.resolveComponentFactory(componentToRender);</code></li>
<li>Real runtime compilation, with <code>Compiler</code>... </li>
</ul>

<p>But the question is how to use that <code>Compiler</code>? The note above says that I should call: <code>Compiler.compileComponentSync/Async</code> - so how? </p>

<p>For example. I want to create <em>(based on some configuration conditions)</em> this kind of template for one kind of settings</p>

<pre class="lang-html prettyprint-override"><code>&lt;form&gt;
   &lt;string-editor
     [propertyName]="'code'"
     [entity]="entity"
   &gt;&lt;/string-editor&gt;
   &lt;string-editor
     [propertyName]="'description'"
     [entity]="entity"
   &gt;&lt;/string-editor&gt;
   ...
</code></pre>

<p>and in another case this one <em>(<code>string-editor</code> is replaced with <code>text-editor</code>)</em></p>

<pre class="lang-html prettyprint-override"><code>&lt;form&gt;
   &lt;text-editor
     [propertyName]="'code'"
     [entity]="entity"
   &gt;&lt;/text-editor&gt;
   ...
</code></pre>

<p>And so on <em>(different number/date/reference <code>editors</code> by property types, skipped some properties for some users...)</em>. i.e. this is an example, the real configuration could generate much more different and complex templates.</p>

<p>The template is changing, so I cannot use <code>ComponentFactoryResolver</code> and pass existing ones... I need a solution with the <code>Compiler</code>.</p>