How do I make dynamic classNames in an ember 2.0 component?
The @dmk'solution is the cleanest one, but if your scenario it is not working you can use classNameBindings:
export default Ember.Component.extend({
classNameBindings: ['getClassNames'],
getClassNames: Ember.computed('extra-classes', function(){
return this.get('extra-classes').replace(',', ' ');
})
})
You can add class names simply by specifying them inside the class
attribute on your component:
{{new-div class="class1 class2"}}