我最近开始学习Angular2。在Angular 2的数值范围内使用ngSwitch
我想知道是否有使用ngSwitch或ngIf angular2
指令的特定数值范围内的可能性?
说我想根据范围更新一些文本的颜色。
<25 = Mark the text in red
>25 && <75 = Mark the text in orange
>75 = Mark the text in green
如何使用Angular2 ngIf/ngSwitch指令实现相同。
有没有办法写这样的东西?
<div [ngIf]="item.status < 25">
<h2 class="text-red">{{item.status}}</h2>
</div>
<div [ngIf]="item.status > 25 && item.status < 75">
<h2 class="headline text-orange">{{item.status}}</h2>
</div>
<div [ngIf]="item.status > 75">
<h2 class="headline text-green">{{item.status}}</h2>
</div>
或者任何与使用ngSwitch,ngSwitchWhen语句有关的事情。