无法读取未定义的Emberjs的属性'default'

时间:2013-12-25 15:22:05

标签: ember.js ember-data ember-app-kit

应用

var App = Ember.Application.extend({
    LOG_ACTIVE_GENERATION: true,
    LOG_MODULE_RESOLVER: true,
    LOG_TRANSITIONS: true,
    LOG_TRANSITIONS_INTERNAL: true,
    LOG_VIEW_LOOKUPS: true,
    modulePrefix: 'appkit', // TODO: loaded via config
    Resolver: Resolver['default']
});


Ember.RSVP.configure('onerror', function(error) {
  // ensure unhandled promises raise awareness.
  // may result in false negatives, but visibility is more important
  if (error instanceof Error) {
    Ember.Logger.assert(false, error);
    Ember.Logger.error(error.stack);
   }    
});
export default App;

商品

App.Store = DS.Store.extend({
    adapter: "DS.RESTAdapter"
});

模型

App.User = DS.Model.extend({
email: DS.attr('string'),
password: DS.attr('string')
});

控制器

var LoginController = Ember.Controller.extend({
actions: {
    login:function(){

        //var data = this.getProperties('email','password');
        console.log("Before Store");
        var store = this.get('store');
        var email = this.get('email');
        var password = this.get('password');
        console.log(":"+email+":"+password);
        var user = store.createRecord('user',{
            email: email,
            password: password
        });
        console.log("User"+user);
    }
}
});
export default LoginController;

我有一个登录视图,触发登录操作。一旦操作被触发,我就会收到错误消息无法读取未定义的属性'default'

我尝试过将App.User.createRecord放入错误无法调用未定义的方法'createRecord'

我正在使用ember-appkit.I还检查了ember-data的版本(版本:1.0.0-beta.5 + canary)我无法确定哪里出错了。

0 个答案:

没有答案