Is it possible to inject the ApplicationAdapter?

I am rather new to ember, but I am trying to setup my app to use a single configuration singleton service that can be re-used by not only the DS.RESTAdapter, but some other parts of my app (mostly components).

As an aside, I noticed that Ember.Application.initializer shows up as a section in the docs, but there’s no API reference?

Thanks for any help!

Here’s a jsbin of what I am attempting to do

You sure can and you were almost there. Ember Data Canary - JSFiddle - Code Playground

1 Like

@jasonmit Excellent! Thank you very much!

Do you know if there’s a good resource discussing the container, and when to do things to it vs. app.register or app.inject? Also is there a reference to which Ember ‘types’ correspond with strings? I find this somewhat confusing.

Thanks again!

app.register just ends up calling the container.register

      function () {
        var container = this.__container__;
        container.register.apply(container, arguments);
      } 

and similarly, app.inject calls container.injection

      function () {
        var container = this.__container__;
        container.injection.apply(container, arguments);
      } 

So use whichever you prefer :smile:

Resources:

http://balinterdi.com/2014/05/01/dependency-injection-in-ember-dot-js.html https://github.com/emberjs/ember.js/blob/master/packages/container/lib/container.js