My JSON data looks like this:
"db" : {
"x" : {
"0" : "A",
"1" : "B",
"2" : "C",
"3" : "D",
"4" : "E",
"5" : "F",
"6" : "G",
"7" : "H",
"8" : "I",
"9" : "J",
"10" : "K",
"11" : "L",
"12" : "M",
"13" : "N"
}
Within the controller, I have the following code:
$scope.object = currentObject.get();
$scope.x = $scope.object.db.x;
(currentObject.get() is a custom function that retrieves data from the database, and the JSON structure matches the one mentioned above)
In the view section, I use ng-repeat as shown below:
<div ng-repeat="y in x">{{y}}</div>
I expected the output to display each value sequentially:
<div>A</div>
<div>B</div>
<div>C</div>
etc. etc.
However, the actual result shows discrepancies in the order of values displayed:
<div>A</div>
<div>K</div>
<div>L</div>
<div>M</div>
<div>N</div>
<div>B</div>
etc. etc.
To address this issue, how can I utilize the orderBy filter within ng-repeat?