Dennis Mende
Dennis Mende

Reputation: 67

emberjs after controller injection into route store of controller is null

I have a question relating to dependency injection. I have created a sessionmanager-controller and added this controller to all routes:

RPC.register('sessionManager:main', RPC.SessionManager);
RPC.inject('route', 'sessionManager', 'sessionManager:main');

After that I looked into the ember-inspector and saw that the store object of the controller is null:

First I have chosen the ApplicationRoute and selected the sessionManager and then I saw that the store of the sessionmanager-controller is null

Does anybody has an idea?

Upvotes: 0

Views: 148

Answers (1)

GJK
GJK

Reputation: 37369

You have to tell the container that you want the store injected into your SessionManager. It only injects into routes and controllers by default.

RPC.inject('sessionManager', 'store', 'store:main');

Also, you probably shouldn't call your session manager a controller, since it's not a controller in the usual Ember.js sense. You're likely to confuse some people if you do.

Upvotes: 1

Related Questions