joevallender
joevallender

Reputation: 4293

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

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?

Upvotes: 3

Views: 1078

Answers (1)

Martin S.
Martin S.

Reputation: 546

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.

Upvotes: 2

Related Questions