I have a view that shows data, and I want to add another class to the list items in my view.
<input type="text" class="filter" placeholder="search..." ng-model="search"> <ul> <li ng-repeat="item in items | filter:search | orderBy:'date'"> {{ date }} {{ item.heading }}<button ng-click="deleteItem(item.ID)"><i class='icon-trash'></i></button> </li> </ul>
I have variables called item.date and I want to compare it with other variables today. Here is the logic:
if (item.date - today <= 0) apply class1 if else (item.date - today > 0 && item.date - today <= 3) apply class2 and so on
How can I achieve this with angular? can i put this logic right in my view or do i need to define it in my controller?
early
source share