The following code activates my click event delegate and all three 'click' handlers in my view hierarchy.
However, I also want to run 'edit' throughout my view hierarchy. 'edit' is just the target of the element in my βchildβ view.
Template
<script type="text/x-handlebars"> {{#view App.GrandparentView}} {{#view App.ParentView}} {{#view App.ChildView}} <span {{action "edit" target="view"}}>Click Me</span> {{/view}} {{/view}} {{/view}} </script>
Javascript
App.GrandparentView = Ember.View.extend({ click: function() { console.log('Grandparent Click Fired!'); }, edit: function () { console.log('GrandParent edit fired'); } }); App.ParentView = Ember.View.extend({ click: function() { console.log('Parent Click Fired!'); }, edit: function () { console.log('Parent edit fired'); } }); App.ChildView = Ember.View.extend({ click: function() { console.log('Child Click Fired!'); }, edit: function () { console.log('Child edit fired'); } });β
Is it not possible to delegate target handlers in a view hierarchy? What i need dont :
App.ChildView = Ember.View.extend({ click: function() { console.log('Child Click Fired!'); }, edit: function () { console.log('Child edit fired'); this.get('parentView').edit();
Here is an example jsFiddle as an example for testing.
source share