Angular: Empty Fiddle

http://angularjs.org/

by Bretto

HTML

<script src="http://code.angularjs.org/angular-1.0.0rc8.js"></script>
<div ng-controller="MyCtrl">
    <ul>
      <li ng-repeat="item in items">
          <button ng-click="setCurrentItem($index)" ng-class="{active: currentItemIndex == $index}">{{item}}</button>
      </li>
    </ul>
</div>

CSS

.active {
    background-color: red;
}

JavaScript

var myApp = angular.module('myApp',[]);

//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});

function MyCtrl($scope) {
    $scope.items = ['bob', 'joe', 'sally', 'louanne'];
    $scope.setCurrentItem = function(index){
        $scope.currentItemIndex = index
    }
}