1

I am having a problem to use loop in angular. See below scenario.

JavaScript code:

for(int i=0;i<6;i++) {
    for(int j=0;j<6;j++) {
       id=i+j;
    }
}

How can I do the same in my angular html?

1
  • what do you mean by angular html ? what is you are trying to achieve, kindly explain the use case and problem/error you are facing. so we can try to help you Commented Jan 12, 2017 at 8:08

2 Answers 2

3

You can use ng-repeat. Like this:

<div ng-repeat="x in [] | range:6">
    <label ng-repeat="y in [] | range:6">{{x * y}}</label>
</div>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Chinito..It is useful for me
0

you can not use for loop in html but you can run loop using ng-repeat in html.This link may help you AngularJS For Loop with Numbers & Ranges

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.