title: ngTemplateOutlet with dynamic value
body: <p>I'm using ngTemplateOutlet with dynamic value.</p>
  
  <pre><code>&lt;ng-container *ngFor="let part of objectKeys(config);"&gt;
      &lt;ng-container *ngIf="config[part]"&gt;
          &lt;ng-container [ngTemplateOutlet]="part"&gt;&lt;/ng-container&gt;
      &lt;/ng-container&gt;
  &lt;/ng-container&gt;
  
  &lt;ng-template #one&gt;&lt;/ng-template&gt;
  &lt;ng-template #two&gt;&lt;/ng-template&gt;
  </code></pre>
  
  <ul>
  <li>Where <code>config</code> is an object</li>
  <li>Where <code>config[part]</code> is a boolean</li>
  <li>Where <code>part</code> is the key of object and the value passed to ngTemplateOutlet.</li>
  </ul>
  
  <p>I always get the error :</p>
  
  <pre><code>ERROR TypeError: templateRef.createEmbeddedView is not a function
  </code></pre>
  
  <p>I've followed : <a href="https://stackoverflow.com/a/41241329/5627096">https://stackoverflow.com/a/41241329/5627096</a></p>
  
  <p>But maybe I can't do something like that.</p>
  
  <p>Actually the config object contains boolean, like I said, and define the part of a form to display.</p>
  
  <p>It's really big form and for better reading, I'm looking for a solution to split it.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>config object looks like :</p>
  
  <pre><code>config = {
      one: true,
      two: false
  }
  </code></pre>
  
  <p>So in my form only the <code>&lt;ng-template #one&gt;&lt;/ng-template&gt;</code> is displayed. If I turn two to true, both are displayed.</p>
  
  <p>I don't know if it's the best approach. I can use *ngIf but with this solution I have really unreadable big code.</p>