Skip to content

Commit

Permalink
fix(scroll): ensure scrollView objects exist
Browse files Browse the repository at this point in the history
Check if scrollView is null when switching off of tabs view. #2181
  • Loading branch information
adamdbradley committed Sep 13, 2014
1 parent 18775ae commit 8883c6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/angular/controller/scrollController.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
});

$timeout(function() {
scrollView.run();
scrollView && scrollView.run && scrollView.run();
});

this._rememberScrollId = null;
Expand All @@ -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');
});
};

Expand Down Expand Up @@ -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);
});
}
};
Expand Down
2 changes: 2 additions & 0 deletions js/views/scrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 8883c6c

Please sign in to comment.