Search code examples
ember-cli

Access Store From Initializer in ember-cli


I have an initializer and the following is coming back as undefined:

container.lookup('store:main')

I am trying to implement this: http://say26.com/using-rails-devise-with-ember-js

Has anybody any ideas why this is?


Solution

  • Here is a code snippet on how I was able to inject the store into all components.

    //initializers/general-setup.js
    import Ember from 'ember';
    
    //The intent of this file is to hold initializers
    //that are general and lack specific context or scope
    export default {
        name: 'general-setup',
        after: 'store',
        initialize: function(container) {
            container.injection('component', 'store', 'store:main');
    
        }
    };