Ian Steffy
Ian Steffy

Reputation: 1234

Ember View for handlebar helper cannot detect when itself is clicked

I have this View for a handlebar helper and I want it to do something when itself is clicked. Nothing is happening though.

VpcYeoman.GlassPanelView = Ember.View.extend({
  tagName: 'div',
  classNames: ['glassWindow'],
  click: function(e) {
    console.log('Embers docs will be their downfall in 2 years because it is unorganized, takes up all of the google search results and gives vague examples if any at all ')
    $(this).css('display', 'none');
    $(this).parent().removeClass('float-right-col-minimized');
  }
});

Ember.Handlebars.helper('glass-Panel', VpcYeoman.GlassPanelView);

{{#glass-Panel}} {{/glass-Panel}} should know when it is clicked using (this) so why isn't this working for me?

Upvotes: 0

Views: 54

Answers (1)

Duncan Walker
Duncan Walker

Reputation: 2201

The click event is being handled correctly. The problem is that you're using $(this) when you should be using this.$(). Here is a working JS Bin.

Using a helper to render a view does not affect the bindings.

Upvotes: 1

Related Questions