I'm trying to make an Contact List example app with ember.js but i'm stuck when i try to save a new 'Contact'.
I have this Model:
Agenda.Contact = DS.Model.extend({
name: DS.attr('string')
});
With this Controller:
Agenda.NewContactController = Ember.Controller.extend({
actions: {
save: function(){
var newContact = this.store.createRecord('contact', {
name: this.get('name')
});
newContact.save();
this.transitionToRoute('contacts');
}
}
});
With this routes:
Agenda.Router.map(function(){
this.resource("contacts", {path: '/'});
this.resource("about");
this.resource("new-contact");
});
Agenda.ContactsRoute= Ember.Route.extend({
model: function(){
return this.store.find("contact");
}
});
When i try to call 'save' action this error appear: 'Uncaught TypeError: Cannot read property 'typeKey' of undefined' on ember-data modelFor function. What have I done wrong?
Aucun commentaire:
Enregistrer un commentaire