mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
test(sideMenu2): update test to reflect changes
This commit is contained in:
@@ -34,7 +34,7 @@ angular.module('ionic.ui.service.scrollDelegate', [])
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
.factory('$ionicScrollDelegate', ['$rootScope', '$timeout', '$location', function($rootScope, $timeout, $location) {
|
||||
.factory('$ionicScrollDelegate', ['$rootScope', '$timeout', '$location', '$ionicViewService', function($rootScope, $timeout, $location, $ionicViewService) {
|
||||
|
||||
function getScrollCtrl($scope) {
|
||||
var ctrl;
|
||||
@@ -131,6 +131,18 @@ angular.module('ionic.ui.service.scrollDelegate', [])
|
||||
}, element[0]);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $ionicScrollDelegate#rememberScrollPosition
|
||||
* @description Used on an instance of $ionicScrollDelegate.
|
||||
*
|
||||
* If this scroll area is associated with a view in the history,
|
||||
* load the last scroll position from the last time this view was shown.
|
||||
*/
|
||||
rememberScrollPosition: function(animate) {
|
||||
scrollScope.$broadcast('scroll.rememberPosition', !!animate);
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Attempt to get the current scroll view in scope (if any)
|
||||
@@ -204,6 +216,15 @@ angular.module('ionic.ui.service.scrollDelegate', [])
|
||||
}
|
||||
});
|
||||
});
|
||||
$scope.$on('scroll.rememberPosition', function(e, animate) {
|
||||
scrollViewResize().then(function() {
|
||||
var view = $ionicViewService.getCurrentView();
|
||||
var values = view && view.rememberedScrollValues;
|
||||
if (view && values) {
|
||||
scrollView.scrollTo(+values.left || null, +values.top || null, animate);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return ionicScrollDelegate;
|
||||
|
||||
Reference in New Issue
Block a user