mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(scroll): ensure scrollView objects exist
Check if scrollView is null when switching off of tabs view. #2181
This commit is contained in:
6
js/angular/controller/scrollController.js
vendored
6
js/angular/controller/scrollController.js
vendored
@@ -114,7 +114,7 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
|
||||
});
|
||||
|
||||
$timeout(function() {
|
||||
scrollView.run();
|
||||
scrollView && scrollView.run && scrollView.run();
|
||||
});
|
||||
|
||||
this._rememberScrollId = null;
|
||||
@@ -129,7 +129,7 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
|
||||
|
||||
this.resize = function() {
|
||||
return $timeout(resize).then(function() {
|
||||
$element.triggerHandler('scroll.resize');
|
||||
$element && $element.triggerHandler('scroll.resize');
|
||||
});
|
||||
};
|
||||
|
||||
@@ -204,7 +204,7 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
|
||||
var values = $$scrollValueCache[this._rememberScrollId];
|
||||
if (values) {
|
||||
this.resize().then(function() {
|
||||
scrollView.scrollTo(+values.left, +values.top, shouldAnimate);
|
||||
scrollView && scrollView.scrollTo && scrollView.scrollTo(+values.left, +values.top, shouldAnimate);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user