The question was too long so I edited it. Here is the angular code snippet in question:
var mod = angular
.module("myMod",[])
.controller("myCont",function($scope){
var obj = [
{name : "Monica", others :[{age:20},{salary:20000}]},
{name : "Rachel", others :[{age:16},{salary:28000}]},
{name : "Pheobe", others :[{age:24},{salary:30000}]}
]
$scope.obj1 = obj;
})
Additionally, here is the relevant HTML file code:
<!DOCTYPE HTML>
<html >
<head>
<script src = "angular.js"></script>
<script src = "angularmy.js"></script>
</head>
<body ng-app="myMod" ng-controller="myCont">
<div>
<ol>
<li ng-repeat="item in obj1" ng-init="parentIndex=$index">{{item.name}}
<ol ng-repeat="items in item.others">
<li >{{items.age }} parentIndex - {{parentIndex}} index - {{$index}}</li>
<li >{{items.salary }} parentIndex - {{parentIndex}} index - {{$index}}</li>
</ol>
</li>
</ol>
</div>
</body>
</html>
However, there seems to be an issue where the output shows duplicate indices for nested list items. Why are there four outputs instead of two? Can someone please assist in identifying what might be wrong with this code?