ember-states icon indicating copy to clipboard operation
ember-states copied to clipboard

Factory name for injecting into StateManagers in an initializer?

Open atduskgreg opened this issue 10 years ago • 3 comments

Hi,

I'm trying to use application.inject() in an initializer in order to make an object available to my StateManager and I was wondering what the correct name for the factory of StateManagers is in order to do this?

For example, here I register my PassManager object and inject it into my application's controllers:

application.register('service:pass_manager', PassManager);
application.inject('controller', 'passManager', 'service:pass_manager');

This works correctly. But now I want to also inject this same PassManager object into the StateManager subclasses I'm using in my application. I tried:

application.inject('stateManager', 'passManager', 'service:passManager');

without any luck. Is it possible to inject into StateManager in this way?

(Note: It happens that the object I'm trying to inject is also a StateManager subclass, but that doesn't seem to me like it would be a problem other than needing to scope this inject statement to not be circular, for example by changing the first argument to: 'stateManager:MyOtherSMSubclass' rather than simply 'stateManager' or whatever the correct factory name is.)

atduskgreg avatar Feb 21 '15 18:02 atduskgreg

statemanager is lagging behind conventions needed to support this nicely.

stefanpenner avatar Feb 21 '15 18:02 stefanpenner

@stefanpenner What would need to be done? Are there docs or anything you can point me to so I could scope out if this was something I could possibly contribute?

atduskgreg avatar Feb 21 '15 18:02 atduskgreg

It would need to resolve states rather then direct references. I don't believe such docs exists. But they really should

stefanpenner avatar Feb 21 '15 21:02 stefanpenner