You have to create a table in your view like this:
<table class="game-board" ng-controller="GameBoardController as gameBoard">
<tr ng-repeat="row in boardArr">
<td ng-repeat="col in row">{{ col }}</td>
</tr>
</table>
So ng-repeat
will iterate over boardArr
and then you can display the values in different cells like I did above. You don’t have to access the value you want to display like this: boardArr[row][col]
because col
already contains the value of boardArr[row][col]
.
4
solved Two dimensional array in AngularJS [duplicate]