get action target element in ember

前端 未结 1 628
清歌不尽
清歌不尽 2021-01-20 16:49

How can I get the target element\'s object on which a click event was fired. For eg, if I have a template like:

相关标签:
1条回答
  • 2021-01-20 17:00

    classNameBinding is a great option for this use case.

    Just for reference, if you need to deal with low level browser events, you can do that in the View layer.

    http://emberjs.com/guides/views/handling-events/

    {{#view App.ClickableView}}
    This is a clickable area!
    {{/view}}
    
    App.ClickableView = Ember.View.extend({
      click: function(evt) {
        alert("ClickableView was clicked!");
      }
    });
    
    0 讨论(0)
提交回复
热议问题