What I'm trying to achieve is a simple iteration with ng-repeat over my nested object which looks something like this
$scope.data = {
name: "",
id: "",
nestedObj: {
prop1: "string",
prop2: false,
prop3: ""
}
};
In my view I try it like this
<div ng-repeat="(key, value) in data.nestedObj">
{{key}} : {{value}}
</div>
...but I constantly get following console error:
Error: Duplicates in a repeater are not allowed. Repeater: (key, value) in data.type key: string
Am I missing out something or what am I doing wrong?
UPDATE!
So after the answer from Sajeetharan and the comment from Slava Utesinov I've set up a Plunkr to give it a try. Surprisingly the answer is, that you obviously can't iterate over an object if it has more than one "empty" key (empty string as value) inside of it.
UPDATE 2
Also it seems, that you can't use the same string value twice ... god I love Angular :)
Finale UPDATE
As Sajeetharan and Slava Utesinov mentioned, track by $index solved it for me
prop2name.nestedObjis array?ng-repeat="(key, value) in data.nestedObj track by $index"