在ember中如何确定视图的名称相对于路由器? [英] in ember how are view's names determined with respect to the router?
问题描述
我有以下资源定义:
this.resource 'groups',{path:'/ groups'},function(){
this.resource('received',{path:'/ received'},function(){
this.route 'show',{path:'/:asset_link_group_id'});
});
当路由器实例化group / received / index的视图时,它会查找名为ReceivedIndexView的视图,为什么不使用GroupsReceivedIndexView?
控制器也是一样 - 它查找ReceivedIndexController ,而不是GroupsReceivedIndexController。为什么?
我花了很多时间来研究这个,因为我在理解如何和命名约定,这是我找到的最有用的网站,关于哪些路由/资源被选择来创建视图/控制器/资源名称。
从彼得我们故意只嵌套一层深。正确的解决方案是@jamesarosen建议的。
https://github.com/emberjs/ember.js/issues/2086
ember rc1. i don't understand how views are automatically instantiated by naming convention wrt their routes.
i have the following resource defined:
this.resource('groups', { path : '/groups' }, function() {
this.resource('received', { path : '/received' }, function() {
this.route('show', { path : '/:asset_link_group_id' });
});
when the router instantiates the view for groups/received/index it looks for a view named ReceivedIndexView. why not GroupsReceivedIndexView ?
the same goes for controllers - it looks for ReceivedIndexController, not GroupsReceivedIndexController. why?
I spent a lot of time researching this as i was having problems understanding the hows and whys of the naming conventions. This is the most informative site I have found in regards to which pieces of the route/resources are picked to create the view/controller/resource name.
From Peter "We intentionally only nest one level deep. The correct solution is what @jamesarosen suggested."
https://github.com/emberjs/ember.js/issues/2086
这篇关于在ember中如何确定视图的名称相对于路由器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!