emberjs action event.target is undefined

后端 未结 1 1034
广开言路
广开言路 2021-01-24 21:40

Here\'s a link to a jsfiddle: http://jsfiddle.net/Qt972/

When you run the fiddle you\'ll see a name and a button to make the \"person\" say hello. This works fine, howev

相关标签:
1条回答
  • 2021-01-24 22:13

    When you do a console.log(arguments) inside your action callback you can see that there are actually 3 parameters passed. The first one is the view, the second is the event and the third is the context.

    You can rewrite your edit action like this:

    edit: function(view, event, context) {
      var target = event.target;
      ...
    }
    

    UPDATE: since commit 657a2664 - available in release 0.9.6 I guess - only a single event parameter is passed which has the view and context as properties. So if you want to access those you have to do the following:

    edit: function(event) {
      var view = event.view;
      var context = event.context;
      ...
    }
    
    0 讨论(0)
提交回复
热议问题