Injection fails on inherited components


I am writing an uploader which handles upload of multiple files concurrently. As of the news that ember 2.0 will move away from controllers, I am trying to get that done using components.

So, I have a file-upload component (which handles rendering of the input button etc.):

// components/file-upload.js
import Ember from 'ember';

export default Ember.Component.extend({

  uploadManager: undefined,


and I have an upload-manager component:

// components/upload-manager.js
import Ember from 'ember';

export default Ember.Component.extend({

If I now add an initializer, that injects the upload-manager into the file-upload component, which looks like:

export default {
  name: 'upload-manager',

  initialize: function(container, application) {

    application.inject('component:file-upload', 'uploadManager', 'component:upload-manager');

and add that component to a template using:


everybody’s happy. The uploadManager is injected into the file-upload component. I would then be able to pass the file that is selected in the ‘file-upload’ to the ‘upload-manager’, which handles the upload and renders the appropriate progress bars.

Now I would like to extend that (and hopefully one day put that into a cli-module). For instance, let’s allow the user to extend the file-upload and add the implementation for a hook that is called after or prior to uploading the file.

// components/custom-upload.js
import FileUpload from './file-upload'

export default FileUpload.extend({

  postUpload: function(e) {
    console.log('post-upload: ' + e);


and we change the template to call our new component instead of file-upload:


What happens now is that the uploadManager never get’s injected.

To work around that I would need to explicitly inject the uploadManager into our new component instead of the base component:

application.inject('component:custom-upload', 'uploadManager', 'component:upload-manager');

Now everybody’s happy again. However, when packaging everything into a reusable module, everybody using that module would have to write their own initializer to get everything working again.

It would be great if we could inject into base classes of inherited components. Is there any reason this is not possible?