ember.js - container.lookup('store:main') returning undefined -
i'm using emberjs , have initializer loading current user in store. have no idea why not working. current initializer is:
export function initialize(container, application) { var store = container.lookup('store:main'); console.log(store); } export default { name: 'current-user', after: 'preload', initialize: initialize };
when log container
, convert global variable in console, , run temp1.lookup('store:main')
object. i'm pretty confused right why initializer isn't able load store.
it's because initializer running before 1 sets store. ember data initializer can found here. described in initializer api, need this:
export default { name: 'current-user', after: ['preload', 'ember-data'], initialize: initialize };
Comments
Post a Comment