Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app="myApp">
<head>
  <script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-controller="MainCtrl">
  <ul>
    <li ng-repeat="item in list"
        ng-class="{selected: item.selected}"
        ng-click='select(item)'>
      {{item.text}}
    </li>
  </ul>
</body>
</html>
 
var app = angular.module('myApp', []);
app.controller("MainCtrl", function ($scope) {
  $scope.list = [
    {text: "Zero", selected: true},
    {text: "One"},
    {text: "Two"},
    {text: "Three"},
  ];
  
  $scope.select = function (item) {
    for(var i = 0; i < $scope.list.length; i++) {
      $scope.list[i].selected = false
    }
    item.selected = true
  };
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers