Emberjs scroll to top when changing view

I achieved this with the following code:

Ember.Route.reopen({
  render: function(controller, model) {
    this._super();
    window.scrollTo(0, 0);
  }
});

Coffee Script:

Ember.Route.reopen
    activate: ->
      @_super()
      window.scrollTo(0, 0)

Javascript:

Ember.Route.reopen({
  activate: function() {
      this._super();
      window.scrollTo(0, 0);
  }
});

@Baruch's solution is good, but when I implemented it I had render on elements within my application state and would cause a scrollTop when it was not needed.

I found this to be much more effective as it only runs on the path change:

App.ApplicationController = Ember.Controller.extend({

  currentPathChanged: function () {
    window.scrollTo(0, 0);
  }.observes('currentPath')

});

Tags:

Ember.Js