mercredi 8 juillet 2015

How do i get the container name of a component within itself?

How do i get the container name of a component within itself?

this.componentNameStream used to kind of work in 1.11.

// in components/my-component.js
export default Component.extend({
   layoutName: "components/my-component",
   partialName: function() {
     //return "my-component"; somehow....
   }.property(); 
});

why? for subclassing reasons:

// in components/blah.js
export default MyComponent.extend({});

// in templates/components/my-component.hbs
<div class="someLayout">
  // partialName is now "components/blah"
  {{ partial partialName }}
</div>

Aucun commentaire:

Enregistrer un commentaire