0

I have this helper call in my template:

{{my-helper id='myID'}}

And I want to make the id param value a bit more dynamic, for example:

{{#each charts as |chart|}}
  {{my-helper id='chart' + chart.id}}
{{/each}}

How I can I use string interpolation and concatenation to create a value for a param in a helper call?

fguillen
  • 36,125
  • 23
  • 149
  • 210

1 Answers1

1

You can use the concat helper to do this:

{{#each charts as |chart|}}
  {{my-helper id=(concat 'chart' chart.id)}}
{{/each}}

It's not ES2015 String interpolation, but it will do what you want.

Pedro Rio
  • 1,444
  • 11
  • 16