Reputation: 2036
Below the code gives output 15
<h1>{{model.ItemExpireAlertTime}}</h1>
however, when I tried to add conditional css class, it is not working for some reason.
<span timer interval="1000" countdown="item.ExpireTicksInSeconds">
<span ng-class="minutes < model.ItemExpireAlertTime ? 'item-expire-alert' : '' " ng-show="minutes < 10">0</span>{{minutes}} dk
<span ng-show="seconds < 10">0</span>{{seconds}} sn
</span>
How can I add alert class when minutes is smaller than ItemExpireAlertTime ?
Upvotes: 0
Views: 70
Reputation: 152
Try
ng-class="{'item-expire-alert': minutes < model.ItemExpireAlertTime}"
Upvotes: 2
Reputation: 2181
You have your ng-class
the wrong way around, try this:
<span timer interval="1000" countdown="item.ExpireTicksInSeconds">
<span ng-class="{'item-expire-alert': minutes < model.ItemExpireAlertTime}" ng-show="minutes < 10">0</span>{{minutes}} dk
<span ng-show="seconds < 10">0</span>{{seconds}} sn
</span>
Upvotes: 2