I need to conditionally add two classes using ng-class.
I want to add class checked
if case
has commments, and I want to add class lots
if the length of the comments array is more than 10.
This works, to add checked
if case has comments:
<p class="comments" ng-class="{checked: case.comments}">
But this doesn't work- it doesn't give me checked
OR lots
:
<p class="comments" ng-class="{checked: case.comments, lots: case.comments.length >= 10}">
Should I skip trying to do this in the HTML & calculate it on a $scope boolean instead, or is there a way to do this in the HTML?
UPDATE: Never mind, the error was in my observational skills, not the code. It works in its given form, but I was looking for the result in the wrong place. D'oh.