Extending a component should keep the parent's layout

If you extend a component to add some new functionality, then it loses its template because it’s based off the class name:

// uses components/my-base.handlebars
MyBaseComponent = Ember.Component.extend({
});

MyOverriddenComponent = MyBaseComponent.extend({
  // we need this otherwise it can't find its template anymore
  layoutName: "components/my-base"
});

Should a component without a layoutName specified look to its superclass?

2 Likes

This helped solve a problem I was facing, thanks! As an ember newcomer, I thought Ember would be doing this automatically. But if you set the layoutName on the MyBaseComponent child instances will use that layout. I find that functionality sufficient for allowing the base component’s template to be inherited.