AngularJS Tutorial - data-ng-repeat Loop through two dimensional array








The following code shows how to use data-ng-repeat Loop through two dimensional array.

Example


<!DOCTYPE html>
<html  ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
angular.module('app', []);
function MainController($scope){<!-- ww  w  .j a  v  a2s  .com-->
    $scope.rows = [
        {col: [ 1,2,3,4 ]},
        {col: [ 5,6,7 ]},
        {col: [ 9,10,11,12 ]}
    ];
}
</script>
</head>
<body>
  <div ng-app="app">
    <div ng-controller="MainController">
        <div class="row" data-ng-repeat="row in rows">
            <div class="col" data-ng-repeat="col in row.col">{{col}}</div>
        </div>
    </div>
  </div>
</body>
</html>

The code above is rendered as follows: