如何在angularJS中按计数使用ng-repeat循环

nat*_*rip 4 angularjs angularjs-ng-repeat

我想使用angularJS绑定将html表行绑定特定的计数时间,如下所示:

<table>
    <tr ng-repeat="x in 5">
       <td>abc</td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

如果有人有解决方案,请尽可能回复.谢谢

Gau*_*ava 6

你可以使用像这样的构造函数(在js中没有代码):

var app = angular.module('myApp', []);

app.controller('myCtrl', function($scope) {

});
Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<body>

  <div ng-app="myApp" ng-controller="myCtrl">
    <table>
      <tr ng-repeat="n in [].constructor(10)  track by $index">
        <td>abc</td>
      </tr>
    </table>
  </div>

</body>

</html>
Run Code Online (Sandbox Code Playgroud)