lundi 26 juin 2017

EmberJS - How not to conflict with actions and events in components

I think there is a an issue between template actions and events in components.

As far as I understand all action clicks will be first executed and bubbled. Finally events in components will be also executed. There are like two parallel stacks executed one after the other.

If you have something like this in the template of a component:

Hello <button onclick=>Click me</button>

and this in the corresponding javascript file:

click: function() {
   alert('second message');
}

You are not sure that the second message will be displayed. If event.stopPropagation() is called in the stack of action (not necessary inside the action 'clickMe'), the second message won't be shown.

Here is a twiddle: http://ift.tt/2tcQdgw

Is there a solution to bypass this problem?




Aucun commentaire:

Enregistrer un commentaire