jeudi 29 janvier 2015

Ember.js - Index route vs. "top-level" resource route?

When creating a "standard" crud resource in Ember.js, what is the difference between the index route and the "main" route?


For example, a users resource:



// app.router.js

Router.map(function() {
this.resource('users', function() {
this.route('new);
this.route('show', { path: '/:user_id'});
this.route('edit', { path: '/:user_id/edit'});
});
});


Which route should contain the following "main" model hook?



// app/routes/users/index.js OR app/routes/users.js?

export default Ember.Route.extend({
model: function() {
return this.store.find('user');
}
});


In other words, should I use the UsersRoute or the UsersIndexRoute? I find this very confusing. Any help is greatly appreciated.





Aucun commentaire:

Enregistrer un commentaire