Trying to alternate classes on elements in an ng-repeat loop based on whether they are even or odd...
<div ng-click="displayHTML(content)" ng-class-odd="'title'" ng-class-even="'html'" ng-repeat="content in name.name">
{{content}}
</div>
When ng-click
is triggered, displayHTML()
is called with the parameter content
to handle a specific div that was clicked.
The goal here is to only execute the function if the clicked element has the class of ng-class-odd
, not ng-class-even
.
In search of a straightforward Angular solution for this issue. If it's not achievable within Angular, what would be the best approach to accomplish this functionality?
$scope.displayHTML = function(obj){
////
}