AngularJS Example:
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<div ng-app>
<div ng-controller="testCtrl">
<div ng-class="getCSSClass()">Testing ng-class using function</div>
</div>
</div>
CSS
.testclass { Background: lightBlue}
JavaScript
function testCtrl($scope) {
$scope.getCSSClass = function() {
return "testclass ";
}
}