mardi 2 juin 2015

Injecting controllers as a service in EmberJS?

I have a controller, that isn't reachable from a route for special tasks. This controller is used by many routes to do these tasks.

At the moment I use controllerFor() to get it.

But since it is used as a service from other controllers I want to add it to every route with DI.

I tried the following in Em.Application.initializer

app.register('workspaceRTC:workspace', App.WorkspaceController);
app.inject('route', 'workspace', 'workspaceRTC:workspace');

Which didn't work.

How do I correctly inject controllers in Ember.js?




Aucun commentaire:

Enregistrer un commentaire