mercredi 27 mars 2019

Is there a way to define and iterate over an array in ember handlebars templates?

I'm working on a styleguide and need to iterate over an array in a handlebars template.

I know that you can iterate over objects or other variables when passed into a template, but is there a way to iterate over a collection defined in the template? I think this breaks the "no-logic in views" concept that handlebars pushes, but I imagine this is a common use case.


  <div class='banners-container'>
    <div class='content'>
      <div class='banner banner- has-icon has-dismiss'>
        <p>Banner </p>
      </div>
    </div>
  </div>



I would expect this to output 4 collections of the banners-container elements, but it's not outputting anything.

What's the best way to handle this use case?




Aucun commentaire:

Enregistrer un commentaire