Reputation: 428
Can anyone help me to get the element on emberJS {{action}}?
ex.
// application.hbs
<a href="#" {{action 'displayLinks'}}>Get me</a>
// app.js
App.IndexRoute = Ember.Route.extend({
actions: {
displayLinks: function() {
// returns an object with, no element properties
console.log(this);
}
}
});
Upvotes: 0
Views: 830
Reputation: 12796
// application.hbs
<a href="#" id="elementId" {{action 'displayLinks' 'elementId'}}>Get me</a>
// app.js
App.ApplicationRoute = Ember.Route.extend({
actions: {
displayLinks: function(id) {
console.log($("#" + id)[0]);
}
}
});
Upvotes: 1