Detect template render in controller?

How do I detect when a template tied to a controller has been rendered?

I need to initialize a jQuery plugin.

I tried init() and reopen() in the controller without luck.


Try didInsertElement on the view (not controller) backing the template.


App.PostsView = Ember.View.extend({
  didInsertElement: function() {

for the posts template

1 Like

Thanks! Works like a charm

I think that using event oriented for this is a better approach:

setupPlugin: function() {

By this way you don’t have to call this._super(arguments) in the redefinition of didInsertElement, what do you think @samselikoff?

1 Like

I actually usually do this too, I think the naming is clearer.

The only time I’ve run into super trouble is with init, don’t think you need to with didInsertElement. But, doing it this way is safer regardless, so I like it.

1 Like