AngularJS 遍历数组(数字系列)
AngularJS loop through array (series of numbers)
我有一系列数字 $scope.N = [1,2,3,4];我想在我的 Html 代码中重复这个,比如 JSON ng-repeat example
<tr ng-repeat="row in categories">
<td>{{row.category}}</td>
</tr>
如何使用数字数组来做到这一点?
像这样:
<tr ng-repeat="num in [1, 2, 3, 4, 5, 6]">
<td ng-bind="num"></td>
</tr>
您当然可以在控制器中声明数组:
$scope.numbers = [1, 2, 3, 4, 5, 6];
然后使用:
<tr ng-repeat="num in numbers">
<td ng-bind="num"></td>
</tr>
我有一系列数字 $scope.N = [1,2,3,4];我想在我的 Html 代码中重复这个,比如 JSON ng-repeat example
<tr ng-repeat="row in categories">
<td>{{row.category}}</td>
</tr>
如何使用数字数组来做到这一点?
像这样:
<tr ng-repeat="num in [1, 2, 3, 4, 5, 6]">
<td ng-bind="num"></td>
</tr>
您当然可以在控制器中声明数组:
$scope.numbers = [1, 2, 3, 4, 5, 6];
然后使用:
<tr ng-repeat="num in numbers">
<td ng-bind="num"></td>
</tr>