我想在我自己创建的插件中创建一个嵌套页面(路径),并创建一个仅限于该特定嵌套页面范围的控制器。
我参考了这篇来自 Ember.js 的文章:
export default function () {
this.route('root_path', {path: '/root_path'}, function () {
this.route('test_nested', {path: '/test_nested'});
});
}
目前,
templates/root_path/test_nested.hbs
已正确加载并在 root_path.hbs 的 outlet 中正常显示,没有任何问题。
问题出在对应的控制器上。
我创建了 controllers/root_path/test_path.js.es6,但它似乎没有加载。(我写了以下代码进行测试)
controllers/root_path/test_nested.js.es6
export default Ember.Controller.extend({
test_num: 0
});
templates/root_path/test_nested.hbs
test
test_num:{{test_num}}
routes/root_path/test_nested.js.es6
我什么也没写。
我认为 test_nested 控制器的放置位置可能不正确。我尝试过多个位置,但都不起作用。
如果您能告知正确的配置方式,将不胜感激。
如果无法使用作用域控制器,我打算改用 root_path 控制器。
(虽然不是最理想的解决方案。)