I am using ember and handlebars for template and I have a case where I need to give custom Ids to the element which is created using loops.
Something like:
{{#each item in list}}
<li {{bindAttr id="item.id"+item.name}}>item.text</li>
{{/each}}
i wanted my id to be a sum of strings id and name. e.g. if
id = 3 and name = summary
then it should render as
<li id="3summary">Summary</li>
You can’t concatenate in Handlebars like that, instead you’ll need to either create a Handlebars helper to do that, or create a computed property in the
Ember.Object:Please see the JSFiddle for a working example: http://jsfiddle.net/u4th3/