我有这样的路由器
App.Router.map(function () {
this.route("about");
this.resource("invoices", { path: "/invoices" }, function () {
this.resource("invoices.show", { path: "/:id" });
this.resource("invoices.update", { path: "/:id/edit" });
this.route("create");
});
});
并生成指向各种路线和资源的链接,我有这个
<nav>
{{#linkTo "invoices.index"}}Invoices{{/linkTo}}
{{#linkTo "invoices.show" 1}}Invoice{{/linkTo}}
{{#linkTo "invoices.create"}}New invoice{{/linkTo}}
</nav>
为什么我必须使用invoices.show
show 资源的名称,然后将其引用为,invoices.show
但我可以将create
其用于路由,然后将其引用为invoices.create
?
理想情况下,我的路由器是
App.Router.map(function () {
this.route("about");
this.resource("invoices", { path: "/invoices" }, function () {
this.resource("show", { path: "/:id" });
this.resource("update", { path: "/:id/edit" });
this.route("create");
});
});
并且它会自动为资源名称添加前缀,因为它们嵌套在发票资源中。正确的?