I already tried searching everywhere how to get the current element and got onto this get action target element in ember, but he's using Views action to get the element on click. Even this one Emberjs: Get the current element is using also view to get it(though the target="TasksView" on action I don't actually get it. What was the parameters on target anyway? lol ) So I am opening this thread to get an element via router.
ex.
App.PostsRoute = Ember.Route.extend({
actions: {
getElement: function(params) {
// how to get the current DOM element that was clicked from here?
// my purpose is to get the clicked element to remove it in the list
// and maybe send it to the server?
console.log(params); // current object model
console.log(this); // the route itself
}
}
});
// template
<ul>
<li class="get-this" {{action 'getElement' this}}></li>
<li class="get-this" {{action 'getElement' this}}></li>
<li class="get-this" {{action 'getElement' this}}></li>
<li class="get-this" {{action 'getElement' this}}></li>
<li class="get-this" {{action 'getElement' this}}></li>
<li class="get-this" {{action 'getElement' this}}></li>
</ul>