我有一条有afterModel
钩子的路线。
afterModel: function(model, transition){
transition.send('doInAppRoute');
}
我的申请路线中有一个动作:
doInAppRoute: function(){
var controller = this.get('controller');
controller.set('someProp', true);
}
当我允许动作从带有afterModel
钩子的路由中冒泡时,我收到以下错误。
Error while processing route: embed Cannot read property 'set' of undefined TypeError: Cannot read property 'set' of undefined
如果我在应用程序模板中调用操作doInAppRoute
,一切都会按预期运行。
如果对doInAppRoute
气泡的操作调用,this.get('controller')
在我的应用程序路由中未定义。为什么?
以及如何更改它以使冒泡操作更新应用程序控制器属性?