The syntax for the ngClass
directive is this:
ng-class="{'haba-haba': thruthValue}"
where
$scope.thruthValue = true;
You can obviously replace true
with false
or a function that returns true
or false
.
Another usage is this:
ng-class="getTheClass()"
where
$scope.getTheClass = function() {
return 'haba-haba';
}
Here's a working fiddle of the second usage.
Also, as other people have pointed out, the second usage is totally against sane MVC. Don't use it unless you know what you are doing.