To make use of the $index
variable within an AngularJS Expression, refer to the documentation for more information.AngularJS Expression Documentation.
For example:
<html ng-app="myApp">
<head>
<meta charset="utf-8>
<title>AngularJS Expression Example</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.min.js"></script>
<script>
var mod = angular.module('myApp', []);
mod.controller('myCtrl', function ($scope){
$scope.tables = ['One', 'Two', 'Three', 'Four', 'Five'];
});
</script>
</head>
<body ng-controller="myCtrl">
<input ng-repeat="table in tables track by $index" type="text" name="lastName" value="{{$index}}">
</body>
</html>