Pergunta

Como anexar uma classe dinâmica a uma visão que já tem uma classe estática?

http://jsfiddle.net/mbmus/4/

Foi útil?

Solução

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>

Outras dicas

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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top