mercredi 1 février 2017

How do you set the class for only the first element in a handlebars foreach loop in emberjs

I am working on an emberjs app which will dynamically create n number of buttons based on my model. To do this, I use a foreach in my template to loop through my model and create a button for each element in the model.


       <li><a id=""  class="zones">: &deg;F</a></li>


Each button has belongs to the class "zones" but I want only the first button to be a part of the class "active" when the app loads. I understand that the emberjs handlebars does not support the @first operator so I am not sure how to go about this.




Aucun commentaire:

Enregistrer un commentaire