How to use basic FOR loop in Ember?


I’m very new for Ember. Can anyone help me to write loops, like for(i=0; i<10; i++) in Ember templates. I’ve found only {{#each}} for loops in templates. I’ve two values and I want to run incremental loop.


In handlebar templates, you can loop over an array only through each. You can workout the logics in controllers/components.


Can you give an example of what you’re trying to do? {{#each}} can handle a lot of use cases. You can use {{#each}} with an index variable, for example:

{{#each users as |user index|}}
  <li>user name: {{}}</li>
  <li>array position: {{index}}</li>


Thanks for reply. I did it by creating an array in component JS and passed this array to component template And used each in template.


As he said, you can get the array index and you can not make checks againt the index.

And my suggestion is, this knida incremental checks must be handled in componet or controller and not in the hbs templates