Angular: Empty Fiddle
http://angularjs.org/
by abenrob
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<table>
<thead></thead>
<tbody>
<tr ng-repeat="sh in supermen" ng-class="getRowClass(sh)" ng-click="select(sh)">
<td>{{sh}}</td>
</tr>
</tbody>
</table>
</div>
CSS
.selected {
color:red;
}
JavaScript
var myApp = angular.module('myApp',[]);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.supermen = ['Superman','Spiderman','Frightendman'];
$scope.selectedSh = 'Superman';
$scope.select = function(sh) {
$scope.selectedSh = sh;
}
$scope.getRowClass = function(sh) {
if (sh == $scope.selectedSh) {
return 'selected';
};
};
}