I defined a 2D array in a controller but when I try to loop over it, with 2 imbricated loops, it not works as exepected. The first loop works fine but the second one is not working.
js/index.js
var gameOfLifeApp = angular.module('gameOfLifeApp', []);
gameOfLifeApp.controller('fieldCtrl', function ($scope) {
$scope.field = [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
];
});
index.html
<!DOCTYPE HTML>
<html ng-app="gameOfLifeApp">
<head>
<meta charset="UTF-8">
<title>Game of Life</title>
<link rel="stylesheet" href="css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script>
<script src="js/index.js"></script>
</head>
<body ng-controller="fieldCtrl">
<div id="field">
<div class="column" ng-repeat="column in field">
<div class="cell" ng-repeat="cell in column"></div>
</div>
</div>
</body>
</html>
output:
<body ng-controller="fieldCtrl" class="ng-scope">
<div id="field">
<!-- ngRepeat: column in field -->
<div class="column ng-scope" ng-repeat="column in field">
<!-- ngRepeat: cell in column -->
</div>
<!-- end ngRepeat: column in field -->
<div class="column ng-scope" ng-repeat="column in field">
<!-- ngRepeat: cell in column -->
</div>
<!-- end ngRepeat: column in field -->
<div class="column ng-scope" ng-repeat="column in field">
<!-- ngRepeat: cell in column -->
</div>
<!-- end ngRepeat: column in field -->
</div>
</body>
What did I do wrong ?