From 00aa24fc7fa37a5e8c20ad79fd4fd19fdca3526e Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Tue, 18 Nov 2014 21:07:15 -0600 Subject: [PATCH] fix(scroll): $historyId should default to root --- js/angular/controller/scrollController.js | 11 ++++++++++- js/angular/service/history.js | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/js/angular/controller/scrollController.js b/js/angular/controller/scrollController.js index 42f6c1e560..fbdc58a67f 100644 --- a/js/angular/controller/scrollController.js +++ b/js/angular/controller/scrollController.js @@ -32,7 +32,16 @@ function($scope, scrollViewOptions, $timeout, $window, $location, $document, $io var deregisterInstance = $ionicScrollDelegate._registerInstance( self, scrollViewOptions.delegateHandle, function() { - return !$scope.$$disconnected && $ionicHistory.currentHistoryId() == $scope.$historyId; + if ($scope.$$disconnected) { + return false; + } + + var currentHistoryId = $ionicHistory.currentHistoryId(); + if (currentHistoryId) { + return currentHistoryId == (isDefined($scope.$historyId) ? $scope.$historyId : 'root'); + } + + return true; } ); diff --git a/js/angular/service/history.js b/js/angular/service/history.js index 3aaeab5a7c..15f3fdd3fe 100644 --- a/js/angular/service/history.js +++ b/js/angular/service/history.js @@ -644,7 +644,7 @@ function($rootScope, $state, $location, $document, $ionicPlatform, $ionicHistory // always reset the keyboard state when change stage $rootScope.$on('$stateChangeStart', function() { - ionic.keyboard.hide(); + ionic.keyboard && ionic.keyboard.hide && ionic.keyboard.hide(); }); $rootScope.$on('$ionicHistory.change', function(e, data) {