@@ -109,37 +109,55 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
109
109
110
110
if ( $attr . scroll === "false" ) {
111
111
//do nothing
112
- } else if ( attr . overflowScroll === "true" || ! $ionicConfig . scrolling . jsScrolling ( ) ) {
113
- // use native scrolling
114
- $element . addClass ( 'overflow-scroll' ) ;
115
112
} else {
116
- var scrollViewOptions = {
117
- el : $element [ 0 ] ,
118
- delegateHandle : attr . delegateHandle ,
119
- locking : ( attr . locking || 'true' ) === 'true' ,
120
- bouncing : $scope . $eval ( $scope . hasBouncing ) ,
121
- startX : $scope . $eval ( $scope . startX ) || 0 ,
122
- startY : $scope . $eval ( $scope . startY ) || 0 ,
123
- scrollbarX : $scope . $eval ( $scope . scrollbarX ) !== false ,
124
- scrollbarY : $scope . $eval ( $scope . scrollbarY ) !== false ,
125
- scrollingX : $scope . direction . indexOf ( 'x' ) >= 0 ,
126
- scrollingY : $scope . direction . indexOf ( 'y' ) >= 0 ,
127
- scrollEventInterval : parseInt ( $scope . scrollEventInterval , 10 ) || 10 ,
128
- scrollingComplete : function ( ) {
129
- $scope . $onScrollComplete ( {
130
- scrollTop : this . __scrollTop ,
131
- scrollLeft : this . __scrollLeft
132
- } ) ;
133
- }
134
- } ;
113
+ var scrollViewOptions = { } ;
114
+
115
+ if ( attr . overflowScroll === "true" || ! $ionicConfig . scrolling . jsScrolling ( ) ) {
116
+ // use native scrolling
117
+ $element . addClass ( 'overflow-scroll' ) ;
118
+
119
+ scrollViewOptions = {
120
+ el : $element [ 0 ] ,
121
+ delegateHandle : attr . delegateHandle ,
122
+ startX : $scope . $eval ( $scope . startX ) || 0 ,
123
+ startY : $scope . $eval ( $scope . startY ) || 0 ,
124
+ nativeScrolling :true
125
+ } ;
126
+
127
+ } else {
128
+ // Use JS scrolling
129
+ scrollViewOptions = {
130
+ el : $element [ 0 ] ,
131
+ delegateHandle : attr . delegateHandle ,
132
+ locking : ( attr . locking || 'true' ) === 'true' ,
133
+ bouncing : $scope . $eval ( $scope . hasBouncing ) ,
134
+ startX : $scope . $eval ( $scope . startX ) || 0 ,
135
+ startY : $scope . $eval ( $scope . startY ) || 0 ,
136
+ scrollbarX : $scope . $eval ( $scope . scrollbarX ) !== false ,
137
+ scrollbarY : $scope . $eval ( $scope . scrollbarY ) !== false ,
138
+ scrollingX : $scope . direction . indexOf ( 'x' ) >= 0 ,
139
+ scrollingY : $scope . direction . indexOf ( 'y' ) >= 0 ,
140
+ scrollEventInterval : parseInt ( $scope . scrollEventInterval , 10 ) || 10 ,
141
+ scrollingComplete : function ( ) {
142
+ $scope . $onScrollComplete ( {
143
+ scrollTop : this . __scrollTop ,
144
+ scrollLeft : this . __scrollLeft
145
+ } ) ;
146
+ }
147
+ } ;
148
+ }
149
+
150
+ // init scroll controller with appropriate options
135
151
$controller ( '$ionicScroll' , {
136
152
$scope : $scope ,
137
153
scrollViewOptions : scrollViewOptions
138
154
} ) ;
139
155
140
156
$scope . $on ( '$destroy' , function ( ) {
141
- scrollViewOptions . scrollingComplete = noop ;
142
- delete scrollViewOptions . el ;
157
+ if ( scrollViewOptions ) {
158
+ scrollViewOptions . scrollingComplete = noop ;
159
+ delete scrollViewOptions . el ;
160
+ }
143
161
innerElement = null ;
144
162
$element = null ;
145
163
attr . $$element = null ;
0 commit comments