Cannot read property 'default' of undefined Emberjs

597 views Asked by At

App

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;

Store

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

Model

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

Controller

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;

I have a login view from where the login action is triggered. As soon as the action is triggered i get an error saying Cannot read property 'default' of undefined .

I have tried putting App.User.createRecord which gives me error Cannot call method 'createRecord' of undefined.

Am using ember-appkit.I have also checked for version of ember-data ( Version: 1.0.0-beta.5+canary ) I am not able to identify where am I going wrong.

0

There are 0 answers