Skip to content

Commit 8883c6c

Browse files
committed
fix(scroll): ensure scrollView objects exist
Check if scrollView is null when switching off of tabs view. #2181
1 parent 18775ae commit 8883c6c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: js/angular/controller/scrollController.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
114114
});
115115

116116
$timeout(function() {
117-
scrollView.run();
117+
scrollView && scrollView.run && scrollView.run();
118118
});
119119

120120
this._rememberScrollId = null;
@@ -129,7 +129,7 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
129129

130130
this.resize = function() {
131131
return $timeout(resize).then(function() {
132-
$element.triggerHandler('scroll.resize');
132+
$element && $element.triggerHandler('scroll.resize');
133133
});
134134
};
135135

@@ -204,7 +204,7 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
204204
var values = $$scrollValueCache[this._rememberScrollId];
205205
if (values) {
206206
this.resize().then(function() {
207-
scrollView.scrollTo(+values.left, +values.top, shouldAnimate);
207+
scrollView && scrollView.scrollTo && scrollView.scrollTo(+values.left, +values.top, shouldAnimate);
208208
});
209209
}
210210
};

Diff for: js/views/scrollView.js

+2
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,8 @@ ionic.views.Scroll = ionic.views.View.inherit({
11141114
},
11151115

11161116
resize: function() {
1117+
if(!this.__container || !this.options) return;
1118+
11171119
// Update Scroller dimensions for changed content
11181120
// Add padding to bottom of content
11191121
this.setDimensions(

0 commit comments

Comments
 (0)