我的router.js
文件是这样的:
this.route('cards', function() {
this.route('all');
this.route('card', {path: '/:card_id'}, function() {
this.route('edit');
});
this.route('new');
});
在all.js
,我:
model() {
return this.store.findAll('card');
}
在cards.js
,我:
beforeModel() {
this.transitionTo('cards.all');
},
model() {
return this.store.findAll('card');
}
正如你所看到的,我正在提出2个请求,而IMO则没有必要。因此,如果我从cards.js
移除了来电,则new.js
无效。
当我从new.js
创建新卡片后,在创建后,它应转到/cards/1
并显示正确的数据。但是,当我从cards.js
删除该行后,在创建卡后,它会转到/cards/1
,但数据不会被保存。