data-ng-repeat Loop through two dimensional array

Description

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){<!--   w  w w  .ja  v  a 2 s  .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>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities