vendredi 9 janvier 2015

Binding events to component's children

I have an ember component with a close button, that will call destroy() on the component. To bind the close button to destroy, for the component I use:



didInsertElement: function () {
var id = '#' + this.elementId; // this is the component id
var close = $(id).find(".close"); // this is the close button
$(close).on("click", alert('123')); //binding...
}


Problem is: the alerts do not happen on click, but when the element is inserted: each component element inserted calls 1 alert(123)


Aucun commentaire:

Enregistrer un commentaire