Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ember.js - how to apply action to entire {{#view}}

Tags:

ember.js

I'd like to specify my action (and 'target' and 'on') in the {{#view}} instead of as below on a contained within

{{#view App.Views.List
        contentBinding="this"
        classNames="item"
        classNameBindings="content.type content.selected:selected"
}}
<div {{action "select"}}>text</div>
{{/view}}

So that the click applied to the whole area of the App.Views.List instance. Is this possible?

like image 494
joevallender Avatar asked Nov 18 '25 04:11

joevallender


1 Answers

How about just defining the method click straight on the View instead of using an {{action}}?

App.Views.List = Ember.View.extend({
    click: function() {
        alert('clicked');
    }
});

See this fiddle for an example.

like image 142
Martin S. Avatar answered Nov 21 '25 10:11

Martin S.