0

I want to get route name from the list of items iterated using {{each}} helper.Some thing like example below.

<script type="text/x-handlebars" data-template-name="orders">
<h2> list all orders</h2> 
{{#each content}}
    {{#linkTo {{route name}} }}Some Text{{/linkTo}}
{{/each}}
</script>`enter code here`
user1138464
  • 39
  • 1
  • 8

1 Answers1

0

You might wanna take a look at this. Have tried, but it would be awesome nested handlebars work.

https://github.com/mateusmaso/handlebars.nested

If the above doesn't work, you can try using a handlebar helper to set a variable within the controller. And use the variable value on the linkTo. It's kind of hacky, but this is what I did:

/**
 * Used to set color of pie chart legend
 */
Ember.Handlebars.helper('setColor', function(controller, property, array, index) {
  controller.set(property, array[index])
})
JJJ
  • 2,889
  • 3
  • 25
  • 43