ng-repeat example

by Dor Cohen

HTML

<script src="http://code.angularjs.org/1.1.3/angular.js"></script>
<div ng-controller='myCtrl'>
  <ul ng-repeat="item	in	arr">
    <li>
      <b>{{	item.name	}}</b> (age {{ item.age }})
    </li>
  </ul>
</div>

JavaScript

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

function myCtrl($scope) {
  $scope.arr = [{
    name: 'John',
    age: 5
  }, {
    name: 'Foo',
    age: 42
  }, {
    name: 'Bar',
    age: 22
  }];
}