【发布时间】:2014-02-20 09:03:29
【问题描述】:
我需要在ember中深度嵌套一些路由,我有这样的东西。
this.resource('wizards', {
path: '/wizards'
}, function() {
this.resource('wizards.google', {
path: '/google'
}, function() {
this.resource('wizards.google.register', {
path: '/register'
}, function() {
this.route('step1');
this.route('step2');
this.route('step3');
this.route('summary');
});
});
});
我期待的是这样的结构:
url /wizards/google/register/step1
route name wizards.google.register.step1
route Wizards.Google.Register.Step1Route
Controller Wizards.Google.Register.Step1Controller
template wizards/google/register/step1
但我明白了:
url /wizards/google/register/step1 //as expected
route name wizards.google.register.step1 //as expected
route WizardsGoogle.Register.Step1Route
Controller WizardsGoogle.Register.Step1Controller
template wizards/google.register.step1
我不知道 ember 何时停止使用大写字母 (WizardsGoogle) 并开始使用命名空间 (WizardsGoogle.Register)。表面上的矛盾让我很困惑。我会期待他们中的任何一个。
【问题讨论】:
-
发现这个讨论discuss.emberjs.com/t/…
-
这是一个非常有趣的问题,尤其是因为 ember 文档似乎建议它应该完全按照您的预期工作。我所能找到的(通过搜索/测试)是它显然只能工作 1 级深度......尽管没有逻辑上的理由为什么会出现这种情况。这里希望有人能给你一个好的答案。
标签: ember.js