How to make a if-else Angular template with only ng-container? : <p>I would like to make an if-else statement in my angular template. I started with that :</p>

<pre><code>&lt;ng-container *ngIf="contributeur.deb; else newDeb" &gt;
    [... HERE IS A RESULT 1]
&lt;/ng-container&gt;
&lt;ng-template #newDeb&gt;
    [... HERE IS A RESULT 2]
&lt;/ng-template&gt;
</code></pre>

<p>And I tried to only use ng-container : </p>

<pre><code>&lt;ng-container *ngIf="contributeur.deb; else newDeb" &gt;
    [... HERE IS A RESULT 1]
&lt;/ng-container&gt;
&lt;ng-container #newDeb&gt;
    [... HERE IS A RESULT 2]
&lt;/ng-container &gt;
</code></pre>

<p>Unfortunately, this does not work. I have this error :</p>

<pre><code>ERROR TypeError: templateRef.createEmbeddedView is not a function
    at ViewContainerRef_.createEmbeddedView (eval at &lt;anonymous&gt; (vendor.bundle.js:11), &lt;anonymous&gt;:10200:52)
    at NgIf._updateView (eval at &lt;anonymous&gt; (vendor.bundle.js:96), &lt;anonymous&gt;:2013:45)
    at NgIf.set [as ngIfElse] (eval at &lt;anonymous&gt; (vendor.bundle.js:96), &lt;anonymous&gt;:1988:18)
    at updateProp (eval at &lt;anonymous&gt; (vendor.bundle.js:11), &lt;anonymous&gt;:11172:37)
    at checkAndUpdateDirectiveInline (eval at &lt;anonymous&gt; (vendor.bundle.js:11), &lt;anonymous&gt;:10873:19)
    at checkAndUpdateNodeInline (eval at &lt;anonymous&gt; (vendor.bundle.js:11), &lt;anonymous&gt;:12290:17)
    at checkAndUpdateNode (eval at &lt;anonymous&gt; (vendor.bundle.js:11), &lt;anonymous&gt;:12258:16)
    at debugCheckAndUpdateNode (eval at &lt;anonymous&gt; (vendor.bundle.js:11), &lt;anonymous&gt;:12887:59)
    at debugCheckDirectivesFn (eval at &lt;anonymous&gt; (vendor.bundle.js:11), &lt;anonymous&gt;:12828:13)
    at Object.eval [as updateDirectives] (ActionsButtons.html:5)
</code></pre>

<p>Can anyone explain me what is going wrong in this code ?</p>
