samedi 13 février 2016

Ember - TypeError: store is undefined

I am using ember 2.3. When I tried to access store inside a component, I am getting the following error in console.

enter image description here

This is what I have tried in component.js

export default Ember.Component.extend({

actions: {
  saveEmployee : function() {
      var store = this.store;

      var newEmployee = store.createRecord("employee", {
          fname: "Manu",
          lname: "Benjamin",
          email: "manu.benjamin@gmail.com",
          department: "IT Services"
      });

      newEmployee.save().then(function() {
          console.log("Record successfully saved!!!!");
      });

  }
}
});

Do I need to include anything to use store in my component?




Aucun commentaire:

Enregistrer un commentaire