As I am new to angular js, please bear with me. In my view, I have a grid of text input boxes that I would like to map to a 2D array in my controller or something similar in java script. The code in my view is as follows:
<div ng-repeat="row in [1,2,3,4,5,6,7,8,9]" class="row">
<div ng-repeat="column in [1,2,3,4,5,6,7,8,9]" class="col-sm-1 no-padding">
<input type="text" class="form-control" ng-model="puzzle.board[row][column]" name="cell[]">
</div>
</div>
For initialization of the puzzle object in my controller class, I use the following code:
$scope.puzzle = {};
$scope.puzzle.dimensions = 9;
$scope.puzzle.board = [$scope.puzzle.dimensions]
for(var i=0; i<$scope.puzzle.dimensions; i++) {
$scope.puzzle.board[i] = [$scope.puzzle.dimensions];
}
However, even after entering values in the input fields, the cell value in the console still shows up as undefined. What could I be missing here?