1
votes

Trying to catch the load and error events for an Image within an EmberJS View handlebars template. The only way I can get it hooked up is to catch the jQuery events in the didInsertElement view function. But this is not a very Ember way of doing things, I've tried to bind the event as you'd do with click events but no luck.

Here is a JSFiddle showing the issue: http://jsfiddle.net/qCaA2/5/

1

1 Answers

2
votes

This is the most elegant I could come up with:

http://jsfiddle.net/4Je9L/5/

I would have preferred to do this, but it is not working, and I'm not sure why not:

http://jsfiddle.net/7JXhA/3/

If you look at the jQuery docs for the load event (http://api.jquery.com/load-event/), it seems that these events may not be able to be handled with delegation the way other DOM events can be. That may be the underlying issue.