无法从组件触发的事件处理程序发送操作
Can't sendAction from event handler triggered by component
我有一个组件发送一个动作:
this.sendAction('action', data.files)
在模板中我使用了这样的组件
{{file-upload url="api/v1/upload" action="finishedUpload"}}
在处理事件的控制器中,我想发送另一个动作(到同一个控制器,但我得到了臭名昭著的 TypeError: undefined is not a function
finishedUpload: function(files) {
this.sendAction('insertImage')
}
如何获取当前控制器的上下文以便我可以在事件处理程序中发送操作?
在controller
下你不必使用sendAction
,只需像这样使用send
finishedUpload: function(files) {
//action to same controller
this.send('insertImage')
}
在component
时你必须使用sendAction
我有一个组件发送一个动作:
this.sendAction('action', data.files)
在模板中我使用了这样的组件
{{file-upload url="api/v1/upload" action="finishedUpload"}}
在处理事件的控制器中,我想发送另一个动作(到同一个控制器,但我得到了臭名昭著的 TypeError: undefined is not a function
finishedUpload: function(files) {
this.sendAction('insertImage')
}
如何获取当前控制器的上下文以便我可以在事件处理程序中发送操作?
在controller
下你不必使用sendAction
,只需像这样使用send
finishedUpload: function(files) {
//action to same controller
this.send('insertImage')
}
在component
时你必须使用sendAction