【发布时间】:2013-01-01 06:28:56
【问题描述】:
我的问题涉及不久前集成到主 ember.js 分支中的新路由机制。
在以下代码块中:
App.Router.map(function(match) {
match("/comments").to("commentsIndex");
});
ember 路由器现在识别 cmets url,并通过“to”方法的第一个参数(在本例中为“cmetsIndex”)将路由处理程序映射到 cmetsIndexRoute。从这里您可以选择使用视图/模板/控制器的默认映射,或者覆盖它们。
但是在下面的嵌套路由中:
App.Router.map(function(match) {
match("/posts").to("posts", function(match) {
match("/").to("postsIndex");
match("/:post_id").to("postShow");
});
});
我现在不确定第一个匹配中“to”方法的第一个参数的作用。换句话说,我不确定下面大写参数的作用:
match("/posts").to("POSTS", function(match) {
那个参数到底是做什么的?
【问题讨论】:
标签: routing ember.js ember-router