Question

Comment appendez une classe dynamique à une vue qui a déjà une classe statique?

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

Était-ce utile?

La 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>

Autres conseils

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>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top