Say for example, we have a list of items. When I hover over a li, I want to receive the node of the element being hovered. How to do this the ember way?
Here’s a toy example:
{{!template.hbs}}
<ul>
<li id="list-element" onmouseenter={{action "doTheThing"}}>Hi, Mom!</li>
</ul>
//component.js
...
actions: {
doTheThing(event): {
console.assert(event.target.id === 'list-element');
}
}
See Handling Events, Sending Events for reference.
2 Likes
Works like a charm. Thank you! @zachgarwood