1

I've got a component sending an action:

this.sendAction('action', data.files)

In the template I used the component like this

{{file-upload url="api/v1/upload" action="finishedUpload"}}

In the controller handling the event I'd like to send another action (to the same controller but I get the infamous TypeError: undefined is not a function

finishedUpload: function(files) {
  this.sendAction('insertImage')
}

How can I get the context of the current controller so I can send actions in the event-handler?

Hedge
  • 16,142
  • 42
  • 141
  • 246

1 Answers1

4

Under controller you don't have to use sendAction, simply use send like this

finishedUpload: function(files) {
  //action to same controller
  this.send('insertImage')
}

When in the component you have to use sendAction

Sushant
  • 1,354
  • 1
  • 14
  • 31