Angular: Empty Fiddle

http://angularjs.org/

by Alexander Tymchuk

HTML

<script src="https://code.angularjs.org/1.3.9/angular.js"></script>
<div ng-app="myApp" ng-controller="MyCtrl">
    <div>selected item is {{selected}}</div>
    <div ng-repeat='item in collection'>
        <button ng-click='select( item )'>{{item}}</button>
    </div>
</div>

JavaScript

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

myApp.controller('MyCtrl', function($scope) {
    $scope.collection = [1, 2, 3, 4, 5];
    $scope.selected = $scope.collection[0];
    $scope.select = function(num) {
        $scope.selected = num;
    }
})