How would I implement a global constants file?


#1

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?


#2

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


#3

Is Ember.Object not a factory type?


#4

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: http://jsfiddle.net/NQKvy/1234/