{{title}}...">

Ember-pre4 helper not passing browser event?

Hi I have the following code in my template:

<div {{action "play" this target="view"}}>{{title}}</div>

      

and the following code in my opinion:

MB3.PlaylistView = Ember.View.extend({
  play: function(event) {
  }
});

      

the parameter event passed to the play function is now a playlist model (passed as "this" in the above action example)

In Ember-pre2, a parameter passed to an action handler received a browser event with attributes like currentTarget

etc and the property context that the model was in.

How can I access parameters like currentTarget

in ember-pre4?

+3


source to share


2 answers


This ticket also discusses a lot:

https://github.com/emberjs/ember.js/issues/1684



The recommended solution would be to create a custom view and then define a click handler. The click handler will be passed to the event as the first argument.

MB3.PlayButtonView = Em.View.extend({
  click: function(event){
  ... click handler
  }
});

      

+3


source


this is by intent but there is an improvement issue for this, see https://github.com/emberjs/ember.js/issues/1986



+1


source







All Articles