我需要在ember中嵌套一些路由,我有類似這樣的東西。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
不使用資本燼停止(當我不明白的是WizardsGoogle)並開始使用名稱空間(WizardsGoogle.Register)。表面上的不一致使我困惑。我會期待他們中的任何一個。
發現此討論http://討論。emberjs.com/t/routers-nested-resource-implementation-is-extremely-limiting/927 –
這是一個非常有趣的問題,尤其是因爲ember文檔似乎表明它應該按照預期工作。我所能找到的(通過搜索/測試)是,它顯然只能工作1級...雖然沒有合乎邏輯的原因,應該是這種情況。希望有人能給你一個很好的答案。 – gravityplanx