How to Create a Listener for Dynamically Created Items with a Valve

advertisements

I'm new to ember and I'm not sure how to create a listener for a dynamic element.

I want to do something similar to this.

$(document).on('click', '.order_here', function(e) {
    e.preventDefault();
    //do some actions
});


In your template:

<div {{action "orderClicked" }}> Order </div>

In your controller:

Ember.Controller.extend({
  actions: {
    orderClicked: function() {
      // handle here.
    }
}

Also check out emberjs guides.