0

I have a loop that executes ten times:

ng-repeat="y in [1,2,3,4,5,6,7,8,9,10]"

Can you do it in a nicer way?

D.SZ
  • 43
  • 6
  • This should help [link](http://stackoverflow.com/a/14695228/4759033) – Satej S Feb 04 '16 at 06:49
  • Possible duplicate of [AngularJS For Loop with Numbers & Ranges](http://stackoverflow.com/questions/11873570/angularjs-for-loop-with-numbers-ranges) – Satej S Feb 04 '16 at 06:51

1 Answers1

1

Yes you can try this:

 ng-repeat="i in getNumber(number)"

In your controller:

$scope.number = 5;
$scope.getNumber = function(num) {
  return new Array(num);   
}

This will allow you the freedom to pass in any range.

ashfaq.p
  • 5,379
  • 21
  • 35