jeudi 2 avril 2015

How to use `model` in the route?

I don't understand which one of the following ways make more sense in the Ember workflow. What is cleaner?


It is better to have one model like in this code?


app/routes/index.js



import Ember from 'ember';

export default Ember.Route.extend({
model: function() {
return {
categories: this.store.find('category'),
products: this.store.find('product')
};
}
});


Or is it better to not use model at all like in this code?


app/routes/index.js



import Ember from 'ember';

export default Ember.Route.extend({
categories: function() {
return categories: this.store.find('category')
},
products: function() {
return products: this.store.find('product')
}
});


Or are both ways fine and I shouldn't worry about this?





Aucun commentaire:

Enregistrer un commentaire