Distinguish between $index in angularJS -


i have 2 ng-repeats, 1 inside other.

     <table ng-repeat="all in values track $index">         <tr ng-repeat = "errors in track $index">          // want use $index of both ng-repeats          </tr>      </table> 

i have use $index of both ng-repeats. how can distinguish 1 $index other?

when using $parent.$index getting parents index:

<div ng-app="myapp">     <div ng-controller="myctrl">         <div ng-repeat="data in parent track $index">             <div ng-repeat="data1 in data track $index">                 {{$parent.$index}}:{{$index}}              </div>         </div>     </div> </div> 

where myapp is:

angular    .module('myapp',[]) .controller('myctrl',function($scope){     $scope.parent = [         ['a','e','i','o','u'],         ['a1','e1','i1','o1','u1'],         ['a2','e2','i2','o2','u2'],          ]; }); 

you can have @ more details in this jsbin.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -