Obversing route change to apply equivalent to onload


#1

I’m trying to observe the route change to apply some common action once rendered. The idea is to have a feature similar to the onload but as we use a single-page app this needs to be triggered on each route changes. (could be scoped to the new view)

I found how to observe the currentPath changes:

App.ApplicationController = Ember.Controller.extend({
  currentPathDidChange: function() {
    prettyPrint()
  }.observes('currentPath');
});

While this works good in some cases, it gets triggered when the route changes, but still to early to apply content changes as it seem to append before the content gets rendered.

Any idea on the best practice to achieve such goal?


#2

Let’s continue on http://stackoverflow.com/questions/16023103/obversing-route-change-to-apply-equivalent-to-onload