1
我不知道是否有使用needs
参数,指定一个所需的控制器(无其重新初始化)的方式,如果所述控制器已初始化由{{render "'.' or '/' containing path"}}
帮手。控制器之间指定依赖如果所需的控制器被初始化,{{渲染}}辅助
例如:
//tasks.hbs
{{render "tasks/create_task"}}
//tasks_controller.js
App.TasksController = Ember.Controller.extend({
needs: 'tasksCreateTask',
aMethod: function() {
// The following code causes re-initialization of the
// App.TasksCreateTaskController, previously initialized by the render helper.
this.get('controllers.tasksCreateTask');
}
});
重新初始化的原因是很明显在余烬控制器缓存相同的控制器不同密钥:密钥controllers:tasks.create_tasks
存在,但不是controllers:tasksCreateTasks
。我认为这可能是一个错误。
请帮我摆脱掉重新初始化。
谢谢!我忘了提及我正在使用Ember RC1。我今天更新到RC2,问题消失了。 – ihalao 2013-04-05 13:34:47