<ng-container> vs <template>
<p><code>ng-container</code> is mentioned in the <a href="https://angular.io/guide/structural-directives#ng-container" rel="noreferrer">official documentation</a> but I'm still trying to understand how it works and what are use cases.</p>
<p>It is particularly mentioned in <a href="https://angular.io/api/common/NgPlural" rel="noreferrer"><code>ngPlural</code></a> and <a href="https://angular.io/api/common/NgSwitch" rel="noreferrer"><code>ngSwitch</code></a> directives.</p>
<p>Does <code>&lt;ng-container&gt;</code> do the same thing as <code>&lt;template&gt;</code> or does it depend on whether a directive was written to use one of them?</p>
<p>Are</p>
<pre class="lang-html prettyprint-override"><code>&lt;ng-container *ngPluralCase=&quot;'=0'&quot;&gt;there is nothing&lt;/ng-container&gt;
</code></pre>
<p>and</p>
<pre class="lang-html prettyprint-override"><code>&lt;template [ngPluralCase]=&quot;'=0'&quot;&gt;there is nothing&lt;/template&gt;
</code></pre>
<p>supposed to be the same?</p>
<p>How do we choose one of them?</p>
<p>How can <code>&lt;ng-container&gt;</code> be used in a custom directive?</p>