我有一个A
发送动作的控制器,this.send('makeItHappen')
我想在控制器中处理它B
。我该怎么做?
JS:
// controllers/documents/datasets/controller-A
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
sendToDataCenter() {
this.send('makeItHappen'); // this throws an error
}
}
});
// controllers/controller-B
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
makeItHappen() {
console.log('It works!!');
}
}
});
在控制器 B 中,它会引发错误:
Uncaught Error: Nothing handled the action 'makeItHappen'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.
请问,有人可以帮忙吗?谢谢你。