From c3da215d15900d350844f4b0f05d5dea8e727a41 Mon Sep 17 00:00:00 2001 From: lufeng Date: Tue, 7 Apr 2015 16:20:42 +0800 Subject: [PATCH] scroll to top after state change success --- .docs/angular-meteor/client/scripts/routes.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.docs/angular-meteor/client/scripts/routes.js b/.docs/angular-meteor/client/scripts/routes.js index 5df7913bf..68dbc5a42 100644 --- a/.docs/angular-meteor/client/scripts/routes.js +++ b/.docs/angular-meteor/client/scripts/routes.js @@ -169,4 +169,11 @@ angular.module("meteor-angular-docs").config(['$urlRouterProvider', '$stateProvi }); $locationProvider.html5Mode(true); - }]); + }]) + + .run(function($rootScope) { + $rootScope.$on('$stateChangeSuccess', function() { + // window.scrollTo(0, 0); + document.body.scrollTop = 0; + }) + })