2016-08-29 59 views

回答

1

在HTML中具有角:

<!-- assuming myArray is a variable on $scope object --> 
<div ng-repeat="innerArray in myArray"> 
    <div ng-repeat="value in innerArray"> 
     {{ value }} 
    </div> 
</div> 

還是在JS,使用for -loops:

var myArray = [[45,67,4],[7.8,6.8,56],[8,7,8.7]]; 
 
    
 
for (var i = 0; i < myArray.length; i++) { 
 
    var innerArray = myArray[i]; 
 
    // loop through inner array 
 
    for (var j = 0; j < innerArray.length; j++) { 
 
     var myValue = innerArray[j]; 
 
     console.log(myValue); 
 
    } 
 
}

1

通過採用NG-重複:

<div ng-repeat="subArray in masterArray"> 
    <div ng-repeat="element in subArray"> 
     {{element}} 
    </div> 
</div> 

將產生的結果45 67 4 7.8 6.8 56 8 7 8.7

在javascript中(angularjs它沒有必要在這裏)

masterArray.forEach(function(subArray) { 
    subArray.forEach(function(element) { 
     console.log(element); 
    }); 
});