【发布时间】:2013-02-05 15:34:13
【问题描述】:
我有以下路线
App.Router.map(function(match) {
this.route("days", { path: "/" });
this.resource("day", { path: "/:day_id" }, function() {
this.resource("slots", { path: "/slots" }, function() {
this.resource("slot", { path: "/:slot_id" }, function() {
this.route("edit", { path: "/edit" });
});
});
});
});
以上我有以下模板
script/app/templates/application.handlebars
script/app/templates/days.handlebars
script/app/templates/day.handlebars
script/app/templates/day/index.handlebars
script/app/templates/slots.handlebars
script/app/templates/slots/index.handlebars
script/app/templates/slot.handlebars
script/app/templates/slot/index.handlebars
script/app/templates/slot/edit.handlebars
- 以上是正确的
- 如果我打算执行以下操作(不包括几天),每个车把模板中应该包含什么 html
-
假设我想做以下事情(不包括几天),我需要定义哪些路线
- when a day is selected I want to show a list of associated models (在这种情况下为插槽)
- 当一个插槽被选中时,我想要从 它是索引页面(根据插槽 ID 显示单个插槽 参数被传递给路由)
更新
到目前为止,标有“资源”的路由似乎需要有一个 {{outlet}} 可用于内部资源或路由以放入一些标记。
例如 day.handlebars 模板有一个 {{outlet}},在我的 day/index.handlebars 模板中,我放入一个 for 循环来显示每一天。接下来在 slot.handlebars 模板中我包含一个 {{outlet}} 并在 slot/index.handlebars 模板中添加另一个 for 循环来显示每个可用的插槽。
【问题讨论】:
标签: ember.js