Make it possible to extend/create Component programatically


Currently it is impossible to create or extend from any view that extends Component as it looses its template, I assume this is because some of the logic that binds the template to the component lives in the tag creation, but this is important for making a reuse of Components.

Here is a common scenario:

ButtonComponent = Ember.Component.extend()
ButtonGroup = Ember.CollectionView.extend({
   itemViewClass: ButtonComponent

Note: This requirement was functioning properly in version 1.0.0-rc7



Ember.Component is simply an Ember.View with a different scope. I miss how problematically create widgets based on Ember.CollectionView and Ember.ContainerView. I was told that it’s possible to create Components based on those classes. But I don’t see how to create them except for creating a dumb template that instantiate them. It works, but it’s lot more spaghetti code than it should.

One way to deal with this would be to convert classes like Ember.ContainerView and Ember.CollectionView to Mixins that could be included in Ember.Component.

I’m interested in other solutions you ember gurus may find.


Ember.Component is a view but there is some magic that relate the template to the Component based on names, When you initiate a component programmatically, it looses its relation to the template, u can specify the template on your own when creating the component instance but then other things don’t work such as yield.

So for now, I find myself moving more and more components into Views and sadly I created a component base view of my own that performs the isolation.

Anyone can put some light here?