I have next template:
<div data-ng-repeat="supplier in order.Suppliers" data-ng-init="supplierIndex = $index">
<div data-ng-repeat="group in supplier.Groups">
{{something}}
</div>
</div>
And model:
$scope.order = {
Suppliers: [
{
Groups: [{ id: 'sss'}, {id: 'ddd'}]
},
{
Groups: [{ id: 'qqqq'}, {id: 'www'}, {id: 'xxx'}]
},
{
Groups: [{ id: 'ooo'}]
}
]
}
I need to display global group index, so output should be like this:
0 1 2 3 4 5
I know that I can use function that calculate index by passed group id at each place we need to display global group index, but how to accomplish this goal most gracefully?
You can use
{{$index}}to show group index on your list.