From 55005b1b13aae78bc4f5d4e1d6f3597bae5a66b9 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 23 Feb 2016 13:03:24 +0100 Subject: [PATCH] Scroll page in beforeModel hook in scroll-mixin The `activate` hook is not always called when the route is used, specifically it will not be called when the model changes, but the change happened within the same route (for example when switching from /travis-ci/travis-web to /travis-ci/travis-core). `beforeModel` is guaranteed to be called every time the model is changed, both when the route is entered for the first time and on any subsequent calls. --- app/mixins/scroll-reset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mixins/scroll-reset.js b/app/mixins/scroll-reset.js index 0909e82a..8067dfcd 100644 --- a/app/mixins/scroll-reset.js +++ b/app/mixins/scroll-reset.js @@ -1,7 +1,7 @@ import Ember from 'ember'; export default Ember.Mixin.create({ - activate: function() { + beforeModel: function() { this._super(...arguments); window.scrollTo(0,0); }