I'm using predicate
to easily sort items in my data model. Now I've working on adding in an up and down arrow icons to show which state the sort is currently in.
Example of predicate orderBy in action: http://plnkr.co/edit/?p=preview
Not sure how to toggle those values however within predicate:
<button type="button"
class="btn btn-default"
ng-click="predicate = 'added_epoch'; reverse=!reverse;">
<div ng-class="recentAdded == 'up' ? 'iconUpBig' : 'iconDownBig'"></div>
Recently added
</button>
Controller
$scope.recentAdded = 'up'
I'm not using a function here, which is why it's a bit hard for me to see how to toggle it now.
Is there a way to hook into this and change the recentAdded
var?
Which will inturn change the ng-class
:
ng-click="predicate = 'added_epoch'; reverse=!reverse;"
Then based on the predicate, toggle the ng-class
:
ng-class="recentAdded == 'up' ? 'iconUpBig' : 'iconDownBig'"