1

I'm using Ember.js and creating a link to a route using the #link-to helper. I'd like to use some data to construct a class name. Is that possible? If so, how can I do that?

{{#link-to 'model' model.property class="myclass--model.property"}}
    {{model.property}}
{{/link-to}}

Of course, with this code class="myclass--model.property" will compile as a string. Is there any way to escape the string? Or is there a different approach I should be using?

Patsy Issa
  • 11,113
  • 4
  • 55
  • 74
Michael Lynch
  • 2,682
  • 3
  • 31
  • 59
  • have a look here http://stackoverflow.com/a/14501015/382809 and use `{{bind-attr class="foo"}}` on the `a` tag if you don't find a proper solution ( i'm no ember user yet ) – Poelinca Dorin Jul 11 '14 at 14:48

1 Answers1

0

You should be able to to something like this:

{{#link-to 'model' model.property class=model.property}}
    {{model.property}}
{{/link-to}}

Take a look at this working JSBin example.