nezhar
3/6/2018 - 7:25 PM

Angular Build In Directives

<div [ngSwitch]="value">
    <p *ngSwitchCase="5">
      Value is 5
    </p>
    <p *ngSwitchCase="10">
      Value is 10
    </p>
    <p *ngSwitchDefault>
      Value is not 5 or 10
    </p>
</div>

<span ng-switch-when="wrong|incorrect" ng-switch-when-separator="|">
<div *ngIf="onlyOdd">
  <li
    class="list-group-item"
    [ngClass]="{odd: number % 2 !== 0}"
    [ngStyle]="{backgroundColor: number % 2 !== 0 ? 'yellow' : 'transparent'}"
    *ngFor="let number of oddNumbers">
    {{ number }}
  </li>
</div>