<div ng-app="myapp"> <div ng-controller="mycontroller as ctrl"> <div ng-repeat="items in ctrl.notes"> <div ng-class="ctrl.getClass(items.done)">{{ items.label }}</div> </div> </div> </div>
div { padding:5px; } .done { background:red; } .pending { background:blue; }
angular.module("myapp",[]).controller("mycontroller",[function() { var self = this; self.notes = [ { label : "test1", done: false }, { label : "test2", done: true }, { label : "test3", done: false } ]; self.getClass = function(status) { return { done : status, pending : !status } } }]);