I would like to clarify the ways to get original event object in action handler.
The documentation says:
To utilize an
event
object as a function parameter:
- Define the event handler in the component (which is designed to receive the browser event object).
- Or, assign an action to an inline event handler in the template (which creates a closure action and does receive the event object as an argument).
So to get an event object on inline handler we do like so:
hbs:
<form onsubmit=>
js:
actions: {
submit(e) {
console.log(e); // original event
}
}
And what about the first option to define event handler in component?
Aucun commentaire:
Enregistrer un commentaire