lundi 9 février 2015

adding second model to route makes first undefined

In my current Ember setup, I retrieve a store for the Index Route. This works fine.



App.IndexRoute = Ember.Route.extend({

model: function(){
var store = this.store.find('index');
return store;
}

});


However, I wish to create a custom form object for the same route, and therefore following the advice of this SO answertried to return two models for the Index Route like this, however, I now get the error



Error while processing route: index that is not defined ReferenceError: that is not defined


New Code



App.IndexRoute = Ember.Route.extend({

model: function(){

return Ember.RSVP.hash({
store: this.store.find('index'),
customform: App.CustomForm.create()
});
}


});


How can I add a second model to this route?


Aucun commentaire:

Enregistrer un commentaire