lundi 9 juillet 2018

Ember remove parent class from child component

I have an addon component that is wrapping a component from a different addon:

// parent-addon/addon/components/parent-component.js
import Component from '@ember/component';
import layout from '../templates/components/parent-component';

export default Component.extend({
  layout,
  classNames: ['parent']
});

// child-addon/addon/components/child-component.js
import Parent from 'parent-addon/components/parent-component';
import layout from '../templates/components/child-component';

export default Parent.extend({
  layout,
});

// child-addon/addon/templates/components/child-component.hbs

  Hello


Because classNames are concatenated, the wrapper div for the child component contains the "parent" class, e.g.

<div class="parent">
  <div class="parent">
    Hello
  </div>
</div>

Is there a way to remove the "parent" class from the classNames of the child component? I don't have access to the parent addon so I can't change any of its code.




Aucun commentaire:

Enregistrer un commentaire