Currently, I am working on storing data in AngularJS. My table consists of various sections, rows, and columns.
In each field, there is a dropdown list with the options "O", "T" or "E". My goal is to store these values in an array format: [section][row][column] - for example, [0][0][0] = "E".
Here is how I have attempted to store the values:
<select id="{{$parent.$parent.$index}}_{{$parent.$index}}_{{$index}}"
ng-change="changePollValue()"
ng-model="selectedValues[$parent.$parent.$index][$parent.$index][$index]" ...>
However, AngularJS seems to be creating nested objects within a one-dimensional array, like this:
"selectedValues" : [ {
"0" : {
"0" : "E",
"1" : "T",
"2" : "O",
"3" : "E",
"4" : "T"
},
"1" : {
"0" : "O",
"1" : "E",
"2" : "T",
"3" : "O",
"4" : "E"
...
The initialization of "selectedValues" is done as follows: $scope.selectedValues = [];
Any suggestions or advice on how to address this issue?