Skip to content

Commit a5d9647

Browse files
committed
fix(scrollView): fix error from checking device before ready
1 parent 71ea118 commit a5d9647

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

js/ext/angular/src/controller/ionicScrollController.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ angular.module('ionic.ui.scroll')
55

66
.controller('$ionicScroll', ['$scope', 'scrollViewOptions', '$timeout', '$ionicScrollDelegate', '$window', function($scope, scrollViewOptions, $timeout, $ionicScrollDelegate, $window) {
77

8-
scrollViewOptions.bouncing = angular.isDefined(scrollViewOptions.bouncing) ?
9-
scrollViewOptions.bouncing :
10-
!ionic.Platform.isAndroid();
11-
128
var self = this;
139

1410
var element = this.element = scrollViewOptions.el;
1511
var scrollView = this.scrollView = new ionic.views.Scroll(scrollViewOptions);
1612

13+
if (!angular.isDefined(scrollViewOptions.bouncing)) {
14+
ionic.Platform.ready(function() {
15+
scrollView.options.bouncing = !ionic.Platform.isAndroid();
16+
});
17+
}
18+
1719
var $element = this.$element = angular.element(element);
1820

1921
//Attach self to element as a controller so other directives can require this controller

js/ext/angular/test/directive/ionicScroll.unit.js

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ describe('Ionic Scroll Directive', function() {
99
timeout = $timeout;
1010
window = $window;
1111
ionic.Platform.setPlatform('Android');
12+
spyOn(ionic.Platform, 'ready').andCallFake(function(cb) {
13+
cb();
14+
});
1215
}));
1316

1417
it('Has $ionicScroll controller', function() {

js/views/scrollView.js

-2
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,6 @@ ionic.views.Scroll = ionic.views.View.inherit({
292292
this.__container = options.el;
293293
this.__content = options.el.firstElementChild;
294294

295-
var self = this;
296-
297295
//Remove any scrollTop attached to these elements; they are virtual scroll now
298296
//This also stops on-load-scroll-to-window.location.hash that the browser does
299297
setTimeout(function() {

0 commit comments

Comments
 (0)