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?

Al.G.
  • 4,327
  • 6
  • 31
  • 56
krish
  • 79
  • 1
  • 8
  • 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 – MGA Jan 12 '17 at 08:08

2 Answers2

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>
Chinito
  • 1,085
  • 1
  • 9
  • 11
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

Community
  • 1
  • 1
Mohammad Sadiqur Rahman
  • 5,379
  • 7
  • 31
  • 45