title: Refactoring *ngIf Container
body: <p>I am looking for a better way of refactoring the following code that I have:</p>
  
  <pre><code>&lt;div class="container"&gt;
      &lt;icon class="icon" *ngIf="A || B"&gt;&lt;/icon&gt;
      &lt;div class="itemOne" *ngIf="A"&gt;&lt;/div&gt;
      &lt;div class="itemTwo" *ngIf="B"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I feel like there is too much-duplicated code in this, but it might also be one of those situations where readability is preferred over any clever tricks.</p>
  
  <p>I looked into using <code>ng-template</code> and <code>[ngSwitch]</code> but couldn't come up with a final solution. <code>[ngSwitch]</code> seems like it could be a good candidate although I would have to make the test variable generic as <code>A</code> and <code>B</code> are of different types.</p>
  
  <p>Thanks</p>