How would I implement a global constants file?


Is the best way to do this to make something like:

App.Constants = Ember.Object.extend();

And then inject this object into all objects in Ember:

App.register("constants:main", App.Constants);
App.inject("object", "constants", "constants:main");

Is this correct?


The inject you specify the factory type as the first argument. So change object to controller for example


Is Ember.Object not a factory type?


All ember objects inherit from the type Ember.Object but are not direct instances of the type, which the container is looking for when trying to resolve what objects to inject when it creates an instance. If you want to inject into the controller, view, routes, models that are created via the container here is am example: