Boostrap list

by Bretto

HTML

<div ng-app="">
  <div ng-controller="Ctrl">
    <ul class="nav nav-list" ng-repeat="color in colors">
      <li ng-click="setSelectedIndex(color)" ng-class="{active: selectedItem == color}">
          <a href="#">{{color}} {{$index}}</a>
      </li>
    </ul>
    <tt>selectedItem = {{selectedItem}}</tt>
   </div>
</div>

CSS

</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ -->
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="http://docs.angularjs.org/angular-1.0.0rc8.min.js"></script>
<style>
.ng-invalid { border: 1px solid red; }

JavaScript

function Ctrl($scope) {

    $scope.colors = ['blue', 'green', 'red'];
    $scope.selectedItem = undefined;

    $scope.setSelectedIndex = function(item) {
        $scope.selectedItem = item;
    }
}