Question

How to append a dynamic class to a view that already has a static class?

http://jsfiddle.net/MBmUs/4/

Was it helpful?

Solution

We've recently added this functionality to Ember. With a build off master, or after 0.9.6 is released, you can do:

<div {{bindAttr class="App.foo:a-bound-class :a-static-class"}}></div>

OTHER TIPS

With ember 0.9.5, You can use the workaround suggested here:

http://codebrief.com/2012/03/eight-ember-dot-js-gotchas-with-workarounds/

With Ember-CLI, you can just render it directly within the class:

{{#each items as |item|}}
    <div class="static-class {{item.class}}">
      <!-- content -->
    </div>
{{/each}}

With HTMLBars this is what works for me:

<div class="{{dynamicAttr}} staticAttr">
  <!-- content -->
</div>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top