fix(scroll): ensure scrollView objects exist

Check if scrollView is null when switching off of tabs view. #2181
This commit is contained in:
Adam Bradley
2014-09-12 22:57:30 -05:00
parent 18775ae169
commit 8883c6ccc5
2 changed files with 5 additions and 3 deletions

View File

@@ -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);
});
}
};

View File

@@ -1114,6 +1114,8 @@ ionic.views.Scroll = ionic.views.View.inherit({
},
resize: function() {
if(!this.__container || !this.options) return;
// Update Scroller dimensions for changed content
// Add padding to bottom of content
this.setDimensions(