(這個問題是與此相關的jsbin)嵌套路由的命名約定是什麼?
我有以下路由器配置:
App.Router.map(function() {
this.resource('profile', function() {
this.route('user');
this.route('userEdit');
this.route('company');
this.route('companyEdit');
this.resource('products', function() {
this.route('index');
this.route('show', { path: '/:product_id/show' });
});
});
});
由此,餘燼數據預計以下控制器:
- ProfileIndexController
- ProfileUserController
- ProfileUserEditController
- ProfileCompanyController
- ProfileCompanyEditController
以下路線:
- ProfileRoute
- ProfileIndexRoute
- ProfileUserRoute
- ProfileUserEditRoute
- P rofileCompanyRoute
- ProfileCompanyEditRoute
而下面的模板:
- 指數
- 輪廓
- 資料/指數
- 資料/用戶
- 資料/ USEREDIT
- PROFI LE /公司
- 資料/ companyEdit
但我無法處理嵌套的資源配置文件/產品。
- ProfileProductsController
- ProfileProductsIndexController在
- ProfileProductsShowController
的路線:我在期待控制器
- ProfileProductsIndexRoute
- ProfileProductsShowRoute
,並在模板:
- 資料/產品
- 資料/產品/指數
相反,通過以下鏈接#/profile/products/index
,燼正在生成以下對象:
generated -> route:products Object {fullName: "route:products"}
generated -> route:products.index Object {fullName: "route:products.index"}
generated -> controller:products Object {fullName: "controller:products"}
Could not find "products" template or view. Nothing will be rendered Object {fullName: "template:products"}
generated -> controller:products.index Object {fullName: "controller:products.index"}
Could not find "products.index" template or view. Nothing will be rendered Object {fullName: "template:products.index"}
Transitioned into 'profile.products.index
這對我來說意想不到:產品嵌套在配置文件中!我當然可以改變我的控制器/路線/模板,但我想知道發生了什麼。我看到的問題是頂級「產品」會與嵌套的「配置文件/產品」發生衝突。
如何處理嵌套資源,關於對象名稱(路由/視圖/模板/控制器)的生成。這在哪裏記錄? (專門爲嵌套資源!)