I'm currently trying to store some data using AngularJS. I have a table with different sections, as well as rows and columns.
Each field has a dropdown-list, containing just the letters "O","T" or "E". What I want is to store these values in an array: [section][row][column] - e.g. [0][0][0] = "E".
This is how I tried to store the values:
<select id="{{$parent.$parent.$index}}_{{$parent.$index}}_{{$index}}"
ng-change="changePollValue()"
ng-model="selectedValues[$parent.$parent.$index][$parent.$index][$index]" ...>
Unfortunately, AngularJS is creating nested objects inside of 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"
...
"selectedValues" is initialized like $scope.selectedValues = [];
Any advice on this?