javascript - Overriding parent model loading in nested Ember.js route -
i'm learning ember , trying figure how signup form.
i have /users
route before , have created users/new
route. in users route load users store - , users/new
route load users - not needed.
should create separate users/index.js
route index or there way override parent model loading should using?
// app/router.js import ember 'ember'; import config './config/environment'; var router = ember.router.extend({ location: config.locationtype }); router.map(function() { this.resource('users', function() { this.route('new'); }); this.route('users', function() { this.route('new'); }); }); export default router;
// routes/users.js import ember 'ember'; export default ember.route.extend({ model: function(){ return this.store.findall('user'); } });
// routes/users/new.js import ember 'ember'; export default ember.route.extend({ model: function(){ return this.store.createrecord('user'); } });
if not need users
collection in users
children routes, reasonable create users.index
route , use users
collection model in users.index
route only. in case remove users
route , controller files.
Comments
Post a Comment