【发布时间】:2015-09-25 12:07:49
【问题描述】:
Ember 2.0 真的让我很难理解新功能。我想从动作函数调用控制器中的方法,但似乎没有找到方法。已经在这上面浪费了一些时间
我已阅读此内容:calling method from action of controller in emberjs,但它仅适用于 Ember 1.x,因为在 Ember 2.0 中不再有 ArrayController,我无法使用 this.send()。
基本上我需要的是:
App.SomeController = Ember.Controller.extend({
methodFunction: function(data) {
console.log("YEY", data);
}
actions: {
sessionAction: function(data) {
this.methodFunction(data);
}
}
});
问题是this.methodFunction不可用
【问题讨论】:
-
Check out this jsbin,你的例子绝对有效!
标签: javascript ember.js