简体   繁体   中英

Not able to load store in Ember app loaded in Therubyracer

I have a simple Ember application for collecting data from a user about gas well volumes. It is a mobile application synchronizing with a server, so I am trying to use CouchDB to handle the data. The client needs the data in a SQL store, so I am trying to map Ember's ORM onto ActiveRecord's by loading the Ember app in Therubyracer.

I can get the frameworks to load without errors, but when I try to access the store to create a new record, it is undefined. The code I am using to access the store is:

var store = App.__container__.lookup('store:main')

Are there any other possible methods for accessing the Ember store?

The store isn't available until dependency injection has finished loading. The most accessible hook for this is the ready hook on the app.

App = Ember.Application.create({
  ready:function(){
   console.log(App.__container__.lookup('store:main'));
  }
});

http://emberjs.jsbin.com/OxIDiVU/450/edit

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM