【发布时间】:2016-07-18 10:50:12
【问题描述】:
我有一个应用程序,它有一个导航栏,我已将它放在“应用程序”上下文中。默认情况下,这些导航栏链接将被禁用,并且只会在模板中的特定操作上启用。
应用程序控制器包含导航栏中链接的禁用状态:-
App.ApplicationController = Ember.Controller.extend({
userName:"TestUser",
firstLinkDisabled:true,
actions:{
handleToggle:function(){
console.log("Handling application action with linkstatus="+this.firstLinkDisabled);
//this.set("firstLinkDisabled",false);
this.toggleProperty("firstLinkDisabled");
}
}
})
索引控制器会将操作发送到应用程序控制器:-
App.IndexController = Ember.Controller.extend({
actions:{
toggleApplicationButton:function(){
this.controllerFor("Application").send("handleToggle");
}
}
})
应用模板:
【问题讨论】:
-
即使在使用 Ember.inject.controller() 之后问题也是一样的。我可以在控制台中看到变量的变化。但在 Ember 检查器中,变量保持不变 并且链接仍然被禁用。这是 Ember 中的错误吗?
标签: ember.js