Moving to ember-cli


I’m moving an existing ember project to ember-cli and that is giving a few headaches.

First is that I’m not using ember-data, but straight Ember.Objects. Where should they live, they seem second class citizens in ember-cli.

Second one is (my bad) that I had variables defined on the app namespace, where should they go? I need data binding on those, and be able to access them in routes, controllers and objects. They are general settings that are valid through the whole site.

Can anybody point me in the right direction?


Classes in the models directory don’t have to be Ember Data models, they can be whatever.

You can use dependency injection to provide access to global objects. Set one up in an initializer and choose to inject it into all routes or controllers, for instance.


Thanks backspace!

Will the injected service also be accessible in an Ember.Object?


hmm, I can’t be certain, but I doubt it. Framework-related objects have access to the container, which I think is how dependencies are injected. A plain Ember.Object isn’t instantiated with access to the container. Perhaps your plain objects should inherit from some base class you create that lets you supply the dependency at the time of instantiation.

Hopefully someone else will read this and have a clearer idea of how to accomplish what you need.