Where does view logic go in ember.js?
In one of my templates I would like to take an integer from the model and
create html from it. I have a Customer model property called starRating
with the value 3. From that value I would like to inject this html into
the Customer template:
<i style="color: #dddddd" class="icon-star"></i>
<i style="color: #dddddd" class="icon-star"></i>
<i style="color: #dddddd" class="icon-star"></i>
<i style="color: #dddddd" class="icon-star-empty"></i>
<i style="color: #dddddd" class="icon-star-empty"></i>
Where do I put the logic which creates that html? I tried adding a
computed property to the view but the whole function definition gets
injected in the page as plaintext. Creating a helper/component seems
excessive for this tiny snippet that will only be used once in the page.
No comments:
Post a Comment