[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>

  

猜你喜欢

转载自www.cnblogs.com/Answer1215/p/10171876.html
今日推荐