AngularJS Live Example

by maxisam

HTML

<div ng:app>
 <form name="myForm" ng-controller="Ctrl">
     <div ng-repeat="item in items">
         <input ng-model="item.value" type="text" >
             {{item.value}}             
     </div>
     <a href="" ng-click="updateItem()" >Update</a>
  </form>
</div>

CSS

</style>
<script src="http://docs-next.angularjs.org/angular-1.0.0rc1.min.js"></script>
<style>
.ng-invalid { border: 1px solid red; } 
body { font-family: Arial,Helvetica,sans-serif; }
body, td, th { font-size: 14px; margin: 0; }
table { border-collapse: separate; border-spacing: 2px; display: table; margin-bottom: 0; margin-top: 0; -moz-box-sizing: border-box; text-indent: 0; }
a:link, a:visited, a:hover { color: #5D6DB6; text-decoration: none; }
.error { color: red; }

JavaScript

function Ctrl($scope) {
    $scope.items = [{value:1}, {value:2}];
    $scope.updateItem = function() {
        $scope.items[0].value++;
        $scope.items[1].value++;
    }
}