[Angular] Angular ngSwitch Core Directive In Detail

When want to display different component based on some conditions:

<div class='course-category' [ngSwitch]="course.category">
    <div class="category" *ngSwitchCase="'BEGINNER'">Beginner</div>
    <div class="category" *ngSwitchCase="'INTERMEDIATE'">Intermediate</div>
    <div class="category" *ngSwitchCase="'ADVANCE'">Advance</div>
    <div class="category" *ngSwitchDefault="'BEGINNER'">All levels</div>
</div>

  

posted @ 2018-12-25 01:16  Zhentiw  阅读(263)  评论(0编辑  收藏  举报