Search code examples
ember.jshandlebars.js

How do I specify a mix of an expression and a string as a class for an ember component?


I want to do something like this

{{#my-custom-component class="some-class-name {{dynamicProperty}}" }}

But this is literally rendering some-class-name {{dynamicProperty}} as the classname, rather than the value it represents.


Solution

  • Use the concat helper:

    {{#my-custom-component class=(concat 'some-class-name' dynamicProperty) }}