【发布时间】:2015-04-09 03:52:00
【问题描述】:
我的问题很“简单”,但我无法用 Ember 解决它......
这是一个小型图书馆应用程序,作者和书籍在这些路线上运行良好
this.resource('books', function () {
this.route('edit', {path: '/:book_id/edit'});
this.route('show', {path: '/:book_id'});
});
this.resource('authors', function () {
this.route('new');
this.route('edit', {path: '/:author_id/edit'});
this.route('show', {path: '/:author_id'});
});
现在我想添加一条路线,允许我使用来自当前作者模板/authors/156的链接注册新书
路由必须打开一个books/new模板,并将new book对象与他的author链接:即我要显示<h1>New book from {{author.name}}</h1>
我应该在现有路线上添加什么路线? 如何将作者引用传递给新书对象?
【问题讨论】:
标签: ember.js ember-data