Using Ember.js, how do I run some JS after a view is rendered?

You need to override didInsertElement as it’s “Called when the element of the view has been inserted into the DOM. Override this function to do any set up that requires an element in the document body.”

Inside the didInsertElement callback, you can use this.$() to get a jQuery object for the view’s element.

Reference: https://github.com/emberjs/ember.js/blob/master/packages/ember-views/lib/views/view.js

Leave a Comment