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?

2

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.