Reputation: 1246
I have a function that lives in a component and I want to pass multiple arguments to it from the parent. I realise I can pass them individually but I'd like to pass them as one arg if possible.
I'd like this to work but the syntax in actionArgs
isnt correct
<MyComponent @actionName={{myAction}} @actionArgs={{myValue, myOptions}} />
<button {{on "click" (action @actionName @actionArgs)}}></button>
I've tried wrapping in parenthesis but that didnt work either.
Upvotes: 0
Views: 548
Reputation: 1246
Amazingly this can be done by passing in the fn arguments with the fn
helper
<MyComponent @actionName={{fn myAction myValue myOptions}} />
<button {{on "click" (action @actionName)}}></button>
Upvotes: 3